Skip to content

Fix crash when calling back a missed call with a stale SIM handle#849

Open
bilec wants to merge 1 commit into
FossifyOrg:mainfrom
bilec:fix/missed-call-callback-npe
Open

Fix crash when calling back a missed call with a stale SIM handle#849
bilec wants to merge 1 commit into
FossifyOrg:mainfrom
bilec:fix/missed-call-callback-npe

Conversation

@bilec

@bilec bilec commented Jul 18, 2026

Copy link
Copy Markdown

Intent.hasExtra(EXTRA_PHONE_ACCOUNT_HANDLE) only confirms the key is present, not that the parcelable resolves to a non-null value. When the handle points to a SIM slot that's present but inactive/locked, getParcelableExtra() can return null and the !! throws an NPE.

Extract the extra defensively and fall back to the existing options (saved custom SIM, default outgoing account, SIM selector dialog) instead of crashing.

Type of change(s)

  • Bug fix
  • Feature / enhancement
  • Infrastructure / tooling (CI, build, deps, tests)
  • Documentation

What changed and why

  • getHandleToUse() used intent.getParcelableExtra(EXTRA_PHONE_ACCOUNT_HANDLE)!! after only checking hasExtra(), which doesn't guarantee the parcelable actually resolves to a non-null handle
  • On a dual-SIM device where the second SIM slot is present but locked/inactive (PIN not entered), the handle fails to resolve, getParcelableExtra() returns null, and !! throws an NPE toast when tapping "Call back" on a missed-call notification
  • Extract the extra into a nullable local and let it fall through the existing when fallbacks (saved custom SIM → default outgoing account → SIM selector dialog) instead of crashing

Tests performed

  • Reproduced the crash on a Samsung Galaxy S24 (dual SIM, second SIM inactive/locked) and captured the stack trace confirming the failure at this exact line
  • Applied the fix, rebuilt, and confirmed tapping "Call back" on a missed-call notification in the same conditions no longer crashes

Closes the following issue(s)

Checklist

  • I read the contribution guidelines.
  • I manually tested my changes on device/emulator (if applicable).
  • I updated the "Unreleased" section in CHANGELOG.md (if applicable).
  • I have self-reviewed my pull request (no typos, formatting errors, etc.).
  • I understand every change in this pull request.

Intent.hasExtra(EXTRA_PHONE_ACCOUNT_HANDLE) only confirms the key is
present, not that the parcelable resolves to a non-null value. When
the handle points to a SIM slot that's present but inactive/locked,
getParcelableExtra() can return null and the !! throws an NPE.

Extract the extra defensively and fall back to the existing options
(saved custom SIM, default outgoing account, SIM selector dialog)
instead of crashing.

Fixes FossifyOrg#134
Fixes FossifyOrg#473
@bilec
bilec requested a review from naveensingh as a code owner July 18, 2026 20:46
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.

SIM selector is not shown for calls initiated externally I can't do call back from the notification screen for missed call.

1 participant