mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-21 07:16:15 -04:00
fix(tool): prevented reading on potentially undefined
This commit is contained in:
parent
aa06b82337
commit
2a54b80de6
1 changed files with 1 additions and 6 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue