Skip to content

Fix crash receiving SMS when the local database insert fails#193

Merged
thestinger merged 1 commit into
GrapheneOS:mainfrom
thomasbuilds:fix/receive-sms-npe
Jul 13, 2026
Merged

Fix crash receiving SMS when the local database insert fails#193
thestinger merged 1 commit into
GrapheneOS:mainfrom
thomasbuilds:fix/receive-sms-npe

Conversation

@thomasbuilds

@thomasbuilds thomasbuilds commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Commit 641e11b dropped the null guard around the received-message log statement while keeping the catch block that swallows database failures; commit 91c7eb7 had introduced the two together. If anything throws inside the transaction before the MessageData is constructed - such as a transient SQLiteException from the participant lookup - message stays null and the unconditional message.getMessageId() call throws an uncaught NullPointerException that kills the process, skipping the notification and pending-message processing even though the message was already written to telephony.

Restore the guard so these failures degrade gracefully again.

@thomasbuilds
thomasbuilds force-pushed the fix/receive-sms-npe branch 2 times, most recently from 90da263 to 81987f3 Compare July 9, 2026 19:06

@RankoR RankoR left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, but please add a test.

Commit 641e11b dropped the null guard around the received-message log
statement while keeping the catch block that swallows database failures;
commit 91c7eb7 had introduced the two together. If anything throws
inside the transaction before the MessageData is constructed - such as
a transient SQLiteException from the participant lookup - message stays
null and the unconditional message.getMessageId() call throws an
uncaught NullPointerException that kills the process, skipping the
notification and pending-message processing even though the message was
already written to telephony.

Restore the guard so these failures degrade gracefully again.
@thomasbuilds
thomasbuilds force-pushed the fix/receive-sms-npe branch from 81987f3 to 696294a Compare July 13, 2026 07:36
@thestinger
thestinger merged commit 5dc2110 into GrapheneOS:main Jul 13, 2026
3 checks passed
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