From ec52612f616d67fbc5acd014b4a9496eadd24eaf Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 16 Jan 2024 18:41:55 -0600 Subject: [PATCH] xmr/wow address check null error fix --- .../cw_based_interface.dart | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart index 19faf7465..9dc0c0b7d 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/cw_based_interface.dart @@ -335,13 +335,15 @@ mixin CwBasedInterface on CryptonoteWallet Future checkReceivingAddressForTransactions() async { try { int highestIndex = -1; - for (var element - in cwWalletBase!.transactionHistory!.transactions!.entries) { - if (element.value.direction == TransactionDirection.incoming) { - int curAddressIndex = - element.value.additionalInfo!['addressIndex'] as int; - if (curAddressIndex > highestIndex) { - highestIndex = curAddressIndex; + final entries = cwWalletBase?.transactionHistory?.transactions?.entries; + if (entries != null) { + for (final element in entries) { + if (element.value.direction == TransactionDirection.incoming) { + int curAddressIndex = + element.value.additionalInfo!['addressIndex'] as int; + if (curAddressIndex > highestIndex) { + highestIndex = curAddressIndex; + } } } }