Skip to content

Don't crash opening the start-conversation sheet with no logged-in user - #2276

Draft
mpretty-cyro wants to merge 1 commit into
session-foundation:devfrom
mpretty-cyro:fix/start-conversation-no-login-state
Draft

mpretty-cyro wants to merge 1 commit into
session-foundation:devfrom
mpretty-cyro:fix/start-conversation-no-login-state

Conversation

@mpretty-cyro

Copy link
Copy Markdown
Collaborator

Contributor checklist

  • I have tested my contribution on these devices:
  • Compile only (compilePlayQaKotlin); not run on a device
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit using the Fixes #1234 syntax

Description

Crash cluster in 1.33.9: IllegalArgumentException: No logged in user from LoginStateRepository.requireLoggedInState, reached from HomeViewModel.onCommand (ShowStartConversationSheet) when the home screen's new-conversation button is tapped (6 users / 6 events). The code is unchanged since before 1.33.7.

The sheet needs the account ID, and requireLocalNumber throws when there is no logged-in state. The stack doesn't show why the home screen is up with no login state, so this doesn't fix that. It reads the account ID with getLocalNumber, and when it's null it logs a warning and ignores the tap. When a user is logged in nothing changes.

Confidence: high that it stops this crash. It doesn't explain the cause, and something else on the same screen may throw for the same reason.

Testing: compiled only. The no-login state wasn't reproduced, and the logged-in path wasn't run on a device; it gets the same account ID as before.

Tapping the home screen's new-conversation button read the account ID with
requireLocalNumber, which throws when there is no logged-in state. Play
Console shows this on 1.33.9 for 6 users. Why Home is on screen without a
login state isn't known, so this only logs and ignores the tap instead of
crashing.

@mpretty-cyro mpretty-cyro left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

.

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.

1 participant