fix(tool): prevented reading on potentially undefined
This commit is contained in:
		
							parent
							
								
									aa06b82337
								
							
						
					
					
						commit
						2a54b80de6
					
				| @ -93,7 +93,6 @@ export default class BaseConverter extends Tool { | |||||||
|   @Ref() readonly inputBaseRef!: VForm |   @Ref() readonly inputBaseRef!: VForm | ||||||
|   @Ref() readonly outputBaseRef!: VForm |   @Ref() readonly outputBaseRef!: VForm | ||||||
| 
 | 
 | ||||||
|   isMounted = false |  | ||||||
|   inputError = '' |   inputError = '' | ||||||
|   inputNumber = '42' |   inputNumber = '42' | ||||||
|   inputBase = 10 |   inputBase = 10 | ||||||
| @ -105,12 +104,8 @@ export default class BaseConverter extends Tool { | |||||||
|     (v: number) => v <= 64 || 'Base should be <= 64' |     (v: number) => v <= 64 || 'Base should be <= 64' | ||||||
|   ] |   ] | ||||||
| 
 | 
 | ||||||
|   mounted() { |  | ||||||
|     this.isMounted = true |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   get outputNumber() { |   get outputNumber() { | ||||||
|     if (this.isMounted && this.inputBaseRef.validate() && this.outputBaseRef.validate()) { |     if (this.inputBaseRef?.validate() && this.outputBaseRef?.validate()) { | ||||||
|       try { |       try { | ||||||
|         return convertBase(this.inputNumber, this.inputBase, this.outputBase) |         return convertBase(this.inputNumber, this.inputBase, this.outputBase) | ||||||
|       } catch (e) { |       } catch (e) { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user