Skip to content

Commit 9720ddd

Browse files
committed
fix: TypeError: Cannot read properties of undefined (reading 'currency') (#3216)
* fix: TypeError: Cannot read properties of undefined (reading 'currency') * fix: improving code
1 parent 8753802 commit 9720ddd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/app/shared/components/fy-currency/fy-currency.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ export class FyCurrencyComponent implements ControlValueAccessor, OnInit, OnChan
178178

179179
showAutoCodeMessage(): void {
180180
const { currency, amount } = this.autoCodedData || {};
181-
const formCurrency = (this.fg?.value as CurrencyAmountFormValues).currency;
182-
const formAmount = (this.fg?.value as CurrencyAmountFormValues).amount;
181+
const { currency: formCurrency, amount: formAmount } = (this.fg?.value as CurrencyAmountFormValues) || {};
183182

184183
const isCurrencyAutoCoded = currency && currency === formCurrency;
185184
const isAmountAutoCoded = amount && amount === formAmount;

0 commit comments

Comments
 (0)