fix: fix app crash importing ledger cp-7.79.0#30522
Conversation
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.
|
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 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
|
@nikolastoimenovski-consensys has teted this PR with correct android build and confirm it is working ok now. i will put a |



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
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
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.0so Android no longer hard-crashes when BLE promise rejections use a null error code.The patch updates
SafePromise.javato route allrejectoverloads throughsafeCode(), substitutingBleErrorwhen the code is null while keeping the original message (and throwable) intact.package.jsonresolutions/dependencies andyarn.locknow resolve the dependency to the patched artifact instead of plain3.4.0.This targets Ledger connect / Select Account pagination failures on Android where React Native’s
@NonNullreject path would otherwise throw a nativeNullPointerException.Reviewed by Cursor Bugbot for commit c20f067. Bugbot is set up for automated code reviews on this repo. Configure here.