From 9720ddd8ebc8ef93c2262b4c1a4fd90731609dc8 Mon Sep 17 00:00:00 2001 From: Vaibhav Singh Date: Thu, 26 Sep 2024 10:25:04 +0530 Subject: [PATCH] fix: TypeError: Cannot read properties of undefined (reading 'currency') (#3216) * fix: TypeError: Cannot read properties of undefined (reading 'currency') * fix: improving code --- src/app/shared/components/fy-currency/fy-currency.component.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/shared/components/fy-currency/fy-currency.component.ts b/src/app/shared/components/fy-currency/fy-currency.component.ts index 88ff260d8e..f5c77f2401 100644 --- a/src/app/shared/components/fy-currency/fy-currency.component.ts +++ b/src/app/shared/components/fy-currency/fy-currency.component.ts @@ -178,8 +178,7 @@ export class FyCurrencyComponent implements ControlValueAccessor, OnInit, OnChan showAutoCodeMessage(): void { const { currency, amount } = this.autoCodedData || {}; - const formCurrency = (this.fg?.value as CurrencyAmountFormValues).currency; - const formAmount = (this.fg?.value as CurrencyAmountFormValues).amount; + const { currency: formCurrency, amount: formAmount } = (this.fg?.value as CurrencyAmountFormValues) || {}; const isCurrencyAutoCoded = currency && currency === formCurrency; const isAmountAutoCoded = amount && amount === formAmount;