diff --git a/cw_monero/lib/api/wallet.dart b/cw_monero/lib/api/wallet.dart index 87abdd95b..8c5ab2d41 100644 --- a/cw_monero/lib/api/wallet.dart +++ b/cw_monero/lib/api/wallet.dart @@ -139,16 +139,16 @@ String getAddress({int accountIndex = 0, int addressIndex = 0}) { } int getFullBalance({int accountIndex = 0}) => - currentWallet!.balance(accountIndex: accountIndex); + currentWallet?.balance(accountIndex: accountIndex) ?? 0; int getUnlockedBalance({int accountIndex = 0}) => - currentWallet!.unlockedBalance(accountIndex: accountIndex); + currentWallet?.unlockedBalance(accountIndex: accountIndex) ?? 0; -int getCurrentHeight() => currentWallet!.blockChainHeight(); +int getCurrentHeight() => currentWallet?.blockChainHeight() ?? 0; -int getNodeHeightSync() => currentWallet!.daemonBlockChainHeight(); +int getNodeHeightSync() => currentWallet?.daemonBlockChainHeight() ?? 0; -bool isConnectedSync() => currentWallet!.connected() != 0; +bool isConnectedSync() => currentWallet?.connected() != 0; Future setupNodeSync( {required String address, diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index d113bcee2..a675042e3 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -593,7 +593,13 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor } final sharedPreferences = await SharedPreferences.getInstance(); await sharedPreferences.setString(PreferencesKey.backgroundSyncLastTrigger(wallet.name), DateTime.now().add(Duration(minutes: 1)).toIso8601String()); - unawaited(wallet.fetchTransactions()); + unawaited(() { + try { + wallet.fetchTransactions(); + } catch (e) { + printV(e); + } + }()); state = TransactionCommitted(); } catch (e) { state = FailureState(translateErrorMessage(e, wallet.type, wallet.currency));