fix(spl): graceful null check operator handling
What changed, and why it matters
This commit fixes a crash in the desktop Solana token send screen. Previously, the app assumed a wallet value was always present and used a forced '!' operator, which would throw an error if the wallet data was still loading or missing. Now it checks for null and shows a 'Loading token data...' message instead of crashing.
No immediate security action required. Treat as a routine stability/UX fix. Verify that other desktop wallet send screens do not use similar unguarded null assertions on provider state.
Security signals we found
Null check operator crash fixed
Defensive null handling added
UI-only crash mitigation in wallet send flow
Evidence from the diff
The patch removes a non-null assertion (!) on ref.watch(pCurrentSolanaTokenWallet) in desktop_sol_token_send.dart and adds a null check. If the Solana token wallet provider emits null (e.g., during initialization or when no wallet is selected), the widget now returns a centered loading placeholder rather than throwing a Null check operator used on a null value runtime exception. This is a defensive UI/UX fix with no direct security boundary being crossed.
Changed components
lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_sol_token_send.dartDesktop Solana token send widgetpCurrentSolanaTokenWallet provider consumerInspect captured patch +11 / −1
diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_sol_token_send.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_sol_token_send.dart
index c35e346..95fd40d 100644
--- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_sol_token_send.dart
+++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_sol_token_send.dart
@@ -691,7 +691,17 @@ class _DesktopSolTokenSendState extends ConsumerState<DesktopSolTokenSend> {
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
- final tokenWallet = ref.watch(pCurrentSolanaTokenWallet)!;
+ final tokenWallet = ref.watch(pCurrentSolanaTokenWallet);
+
+ // If wallet is not initialized, show a placeholder.
+ if (tokenWallet == null) {
+ return Center(
+ child: Text(
+ "Loading token data...",
+ style: STextStyles.subtitle500(context),
+ ),
+ );
+ }
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
Why this scored 31/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.