From ae824d6455350eae912eb38fc5cc1747850e35fd Mon Sep 17 00:00:00 2001 From: jwinterm Date: Tue, 18 Aug 2026 08:28:25 -0400 Subject: [PATCH] fix: WOW crash on Receive -> Addresses (AccountPreviewHeader) User report 05ebf86e: monero?.getCurrentAccount on a Wownero wallet. The null-aware operator guards plugin presence, not wallet type, so the Monero bridge always ran and CWMonero's cast threw before the ?? chain could reach the wownero branch. Dispatch by wallet.type instead. Swept lib for the same anti-pattern: account_customizer already dispatches (fixed 2026-08-07) and the settings_store call sites take no wallet argument; this was the last live instance. --- lib/new-ui/pages/addresses_page.dart | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/new-ui/pages/addresses_page.dart b/lib/new-ui/pages/addresses_page.dart index 00177f21f..5e3646de5 100644 --- a/lib/new-ui/pages/addresses_page.dart +++ b/lib/new-ui/pages/addresses_page.dart @@ -271,9 +271,14 @@ class AccountPreviewHeader extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - monero?.getCurrentAccount(dashboardViewModel.wallet).label ?? - wownero?.getCurrentAccount(dashboardViewModel.wallet).label ?? - "", + // Dispatch by wallet type: the null-aware operator only + // guards plugin presence, so monero?. on a Wownero + // wallet still executes CWMonero's cast and throws. + dashboardViewModel.wallet.type == WalletType.monero + ? monero?.getCurrentAccount(dashboardViewModel.wallet).label ?? "" + : dashboardViewModel.wallet.type == WalletType.wownero + ? wownero?.getCurrentAccount(dashboardViewModel.wallet).label ?? "" + : "", style: TextStyle(fontSize: 12, color: Theme.of(context).colorScheme.primary), ), Text(