Skip to content

Conversation

@levonpetrosyan93
Copy link
Contributor

Fix for issue #1530

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 10, 2025

Walkthrough

Adds defensive null-checks for Spark wallet availability in two UI flows: anonymize button enablement (overviewpage.cpp) and automint Spark notification display (walletview.cpp), returning early when wallet or sparkWallet is absent.

Changes

Cohort / File(s) Summary
Spark wallet validation guards
src/qt/overviewpage.cpp, src/qt/walletview.cpp
Added null checks for walletModel->getWallet() and walletModel->getWallet()->sparkWallet. In overviewpage.cpp the anonymize button enablement condition now requires sparkWallet to exist and Spark allowed. In walletview.cpp the automint notification routine returns early if wallet or sparkWallet is null.

Sequence Diagram(s)

sequenceDiagram
    participant UI as UI Layer
    participant WM as WalletModel
    participant W as Wallet
    participant SW as sparkWallet

    UI->>WM: request walletModel->getWallet()
    WM-->>UI: Wallet (maybe null)
    alt wallet is null
        UI-->>UI: return / do not enable UI action
    else wallet present
        UI->>W: access sparkWallet
        alt sparkWallet is null
            UI-->>UI: return / do not enable UI action
        else sparkWallet present
            UI-->>UI: proceed to enable anonymize button / show automint notification
        end
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Localized, consistent defensive checks across two UI functions.
  • Review focus areas:
    • Ensure null-check ordering is safe (walletModel->getWallet() before accessing sparkWallet).
    • Confirm conditions match intended UX gating (spark allowed + anonymizableBalance check).

Possibly related PRs

Suggested reviewers

  • psolstice
  • aleflm

Poem

🐇 I hopped through code at break of day,
Checked every spark that crossed my way,
If wallet's missing, I politely stop—
No nulls allowed, the guards don't drop. ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete, missing the mandatory 'PR intention' section that explains what the PR does and what issue it solves in detail. Add a comprehensive 'PR intention' section explaining the crash issue, root cause, and how the null checks fix it for non-HD wallets.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main fix: adding crash prevention for non-HD wallets through null checks in the code changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nonHd

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3934c06 and ad711a1.

📒 Files selected for processing (2)
  • src/qt/overviewpage.cpp (1 hunks)
  • src/qt/walletview.cpp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/qt/walletview.cpp
  • src/qt/overviewpage.cpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: build-guix-arm64-apple-darwin
  • GitHub Check: build-guix-x86_64-apple-darwin
  • GitHub Check: build-guix-x86_64-linux-gnu
  • GitHub Check: build-windows-cmake
  • GitHub Check: build-mac-cmake
  • GitHub Check: build-guix-aarch64-linux-gnu
  • GitHub Check: build-linux-cmake
  • GitHub Check: build-guix-x86_64-w64-mingw32
  • GitHub Check: build-guix-x86_64-linux-gnu
  • GitHub Check: build-guix-arm64-apple-darwin
  • GitHub Check: build-mac-cmake
  • GitHub Check: build-guix-x86_64-apple-darwin
  • GitHub Check: build-guix-x86_64-w64-mingw32
  • GitHub Check: build-guix-aarch64-linux-gnu
  • GitHub Check: build-windows-cmake
  • GitHub Check: build-linux-cmake

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot requested review from aleflm and psolstice November 10, 2025 09:14
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ebb83b2 and 3934c06.

📒 Files selected for processing (2)
  • src/qt/overviewpage.cpp (1 hunks)
  • src/qt/walletview.cpp (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: build-guix-arm64-apple-darwin
  • GitHub Check: build-guix-x86_64-apple-darwin
  • GitHub Check: build-guix-x86_64-w64-mingw32
  • GitHub Check: build-guix-x86_64-linux-gnu
  • GitHub Check: build-mac-cmake
  • GitHub Check: build-guix-aarch64-linux-gnu
  • GitHub Check: build-windows-cmake
  • GitHub Check: build-linux-cmake
  • GitHub Check: build-guix-x86_64-apple-darwin
  • GitHub Check: build-guix-aarch64-linux-gnu
  • GitHub Check: build-guix-arm64-apple-darwin
  • GitHub Check: build-guix-x86_64-w64-mingw32
  • GitHub Check: build-windows-cmake
  • GitHub Check: build-mac-cmake
  • GitHub Check: build-guix-x86_64-linux-gnu
  • GitHub Check: build-linux-cmake

@justanwar
Copy link
Member

Tested. Crashes when generating Spark address in Receive tab (should show error/warning instead).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants