fix null-check crash in offline mode sheet toggle#8753
Merged
Conversation
Guard setState/setSheetState with mounted checks after the async batchMode update, since the profile page or sheet may already be disposed by the time the await resolves. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Git-on-my-level
approved these changes
Jul 1, 2026
Git-on-my-level
left a comment
Collaborator
There was a problem hiding this comment.
LGTM — the fix is correct. Guarding setSheetState/setState with mounted checks after the await is the right pattern for this disposed-state crash. Test plan covers both the race and the normal path.
One heads-up: _showBackgroundModeSheet (~line 249) has the same unguarded setSheetState(() {}); setState(() {}); after await captureProvider.setBackgroundModeEnabled(value). It's the same latent crash signature — worth guarding in a follow-up when convenient.
Reviewed by the Omi PR maintainer automation (AI).
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.
Summary
Null check operator used on a null valueinState.setState) originating from_ProfilePageState._showOfflineModeSheet.setEnabledis async; afterawait captureProvider.setBatchMode(value)resolves, the offline-mode bottom sheet or the profile page itself may already be disposed (user closed the sheet or navigated away), so callingsetSheetState/setStatehit a disposedState.mountedchecks (sheetContext.mountedfor the sheet'sStatefulBuilder,mountedfor the outer_ProfilePageState).Crashlytics issue: https://console.firebase.google.com/u/0/project/based-hardware/crashlytics/app/android:com.friend.ios/issues/0685c58070c96ed5989ef2091f644ff4?time=7d&types=crash
Test plan
setBatchModecompletes — confirm no crash and no unhandled exception in logs.🤖 Generated with Claude Code