fix(react-native): reject instead of crashing when no Activity on Android (FR-25939) - #94
Closed
dianaKhortiuk-frontegg wants to merge 1 commit into
Closed
fix(react-native): reject instead of crashing when no Activity on Android (FR-25939)#94dianaKhortiuk-frontegg wants to merge 1 commit into
dianaKhortiuk-frontegg wants to merge 1 commit into
Conversation
…roid (FR-25939) login/directLoginAction/loginWithPasskeys/registerPasskeys used currentActivity!!, which throws KotlinNullPointerException and crashes the app when currentActivity is null (app backgrounded / activity recreated). Extract a top-level withActivityOrReject(activity, promise, block) that rejects with NO_ACTIVITY and skips the block — matching stepUp and openAdminPortal, which already null-check — and route the four sites through it. Test: WithActivityOrRejectTest (RED->GREEN).
This was referenced Jul 22, 2026
Collaborator
Author
|
Superseded by #100, which combines FR-25937/38/39/40 into a single PR. Branch kept. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FR-25939 — Android
currentActivity!!NPE crashlogin,directLoginAction,loginWithPasskeysandregisterPasskeysusedcurrentActivity!!. WhencurrentActivityis null (app backgrounded / activity recreated) this throwsKotlinNullPointerException→ app crash instead of a recoverable rejection.stepUpandopenAdminPortalalready null-check andreject("NO_ACTIVITY", …).Fix
Extract a top-level
withActivityOrReject(activity, promise, block)that rejects withNO_ACTIVITYand skips the block when the activity is null, and route the four remaining methods through it.Tests
WithActivityOrRejectTest: null activity → rejectsNO_ACTIVITY, block not run, promise not resolved. RED → GREEN via the example-app Gradle harness (:frontegg_react-native:testDebugUnitTest).Note
The stale branch
fix/android-currentactivity-stepup-adminportal(duplicates the already-merged stepUp/adminPortal fix and does not cover these four sites) can be deleted.