Skip to content

fix: fix app crash importing ledger cp-7.79.0#30522

Merged
dawnseeker8 merged 8 commits into
mainfrom
fix/30491-fix-app-crash-importing-ledger
May 27, 2026
Merged

fix: fix app crash importing ledger cp-7.79.0#30522
dawnseeker8 merged 8 commits into
mainfrom
fix/30491-fix-app-crash-importing-ledger

Conversation

@dawnseeker8

@dawnseeker8 dawnseeker8 commented May 21, 2026

Copy link
Copy Markdown
Contributor

Description

Patch react-native-ble-plx to guard against null reject codes in SafePromise.java. When BLE operations fail with a null error code, React Native's @nonnull promise reject path throws a native NullPointerException, crashing the app during Ledger connect or Select Account pagination on Android.
Substitutes a stable fallback code (BleError) while preserving the existing error message payload.
Fixes #30491

The proper fix will require update the react-native-ble-plx library in accounts repo.

Changelog

CHANGELOG entry: Patch react-native-ble-plx to prevent nullPointerException throw from native code to crash the app.

Related issues

Fixes: #30491

Manual testing steps

Test plan
On Android (e.g. Samsung Galaxy S22, Android 16), add a hardware wallet account via Ledger
Verify the app does not crash when connecting Ledger
Verify pagination in the Select Account interface works without crashing
Verify selecting an account completes successfully
Smoke test other BLE flows (if applicable) to confirm no regressions

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Small, localized native guard in a vendored BLE dependency; low blast radius beyond BLE error handling on Android.

Overview
Adds a Yarn patch for react-native-ble-plx@3.4.0 so Android no longer hard-crashes when BLE promise rejections use a null error code.

The patch updates SafePromise.java to route all reject overloads through safeCode(), substituting BleError when the code is null while keeping the original message (and throwable) intact. package.json resolutions/dependencies and yarn.lock now resolve the dependency to the patched artifact instead of plain 3.4.0.

This targets Ledger connect / Select Account pagination failures on Android where React Native’s @NonNull reject path would otherwise throw a native NullPointerException.

Reviewed by Cursor Bugbot for commit c20f067. Bugbot is set up for automated code reviews on this repo. Configure here.

This commit updates the `.github/workflows/build-android.yml` to allow the `prod` environment as a valid input for Android builds. It modifies the input validation and dispatch options to include `prod`, ensuring that builds targeting production do not fail due to input validation errors. This change enhances the CI workflow for Android deployments.
This commit adds a patch for the `react-native-ble-plx` dependency in `package.json`, ensuring that the application uses a modified version that addresses specific issues. The patch file is also created to implement changes in the `SafePromise.java` file, enhancing error handling by providing a fallback reject code to prevent potential crashes when null values are passed. This improves the stability of the application when interacting with Bluetooth functionalities.
This commit modifies the `yarn.lock` file to apply a patch for the `react-native-ble-plx` dependency, ensuring that the application uses a modified version that addresses specific issues. The patch file is referenced in the lock file, enhancing the stability of Bluetooth functionalities in the application.
@dawnseeker8 dawnseeker8 requested a review from a team as a code owner May 21, 2026 12:10
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@dawnseeker8 dawnseeker8 changed the title Fix/30491 fix app crash importing ledger fix: fix app crash importing ledger May 21, 2026
@owencraston

Copy link
Copy Markdown
Contributor

@dawnseeker8 could we resolve this by updating the package? If not we should probably push the rn ble-plx team to fix this upstream as well.

@dawnseeker8

Copy link
Copy Markdown
Contributor Author

@dawnseeker8 could we resolve this by updating the package? If not we should probably push the rn ble-plx team to fix this upstream as well.

hi, i am creating this version just as backup, and will create a version with library upgrade to test, since the library has been used in @ledger bluetooth libraries internally, the testing impact will be bigger. that is why there is one this version and other with library update version

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.24%. Comparing base (2690872) to head (59064d9).
⚠️ Report is 84 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #30522      +/-   ##
==========================================
+ Coverage   82.22%   82.24%   +0.01%     
==========================================
  Files        5517     5521       +4     
  Lines      148594   148670      +76     
  Branches    34224    34240      +16     
==========================================
+ Hits       122184   122267      +83     
+ Misses      18084    18079       -5     
+ Partials     8326     8324       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeSwap, SmokeStake, SmokeWalletPlatform, SmokeMoney, SmokePerps, SmokeMultiChainAPI, SmokePredictions, SmokeSeedlessOnboarding, SmokeBrowser, SmokeSnaps
  • Selected Performance tags: @PerformanceAccountList, @PerformanceOnboarding, @PerformanceLogin, @PerformanceSwaps, @PerformanceLaunch, @PerformanceAssetLoading, @PerformancePredict, @PerformancePreps
  • Risk Level: high
  • AI Confidence: 100%
click to see 🤖 AI reasoning details

E2E Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/permission-controller. Running all tests.

Performance Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/permission-controller. Running all tests.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@dawnseeker8

Copy link
Copy Markdown
Contributor Author

@nikolastoimenovski-consensys has teted this PR with correct android build and confirm it is working ok now. i will put a QA pass label on this PR.

@dawnseeker8 dawnseeker8 added the QA Passed QA testing has been completed and passed label May 27, 2026
@dawnseeker8 dawnseeker8 changed the title fix: fix app crash importing ledger fix: fix app crash importing ledger cp-7.79.0 May 27, 2026
@dawnseeker8 dawnseeker8 added this pull request to the merge queue May 27, 2026
Merged via the queue into main with commit f48a706 May 27, 2026
220 of 223 checks passed
@dawnseeker8 dawnseeker8 deleted the fix/30491-fix-app-crash-importing-ledger branch May 27, 2026 01:19
@github-actions github-actions Bot locked and limited conversation to collaborators May 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA Passed QA testing has been completed and passed size-S team-accounts-framework Accounts team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [Ledger] Select Account - The app crashes when the user tries to add Ledger account or use the pagination

4 participants