Repository navigation
fix(requests): initialize deck fields before the collector runs - #1880
Merged
Merged
Conversation
Opening a group chat on 2026.10.5 (4951) crashed with an NPE in holdForEndedFade. viewModelScope runs on Main.immediate, so the deck collector started in init publishes before the constructor returns. shownNow, settle and settledDeck were declared after init and were still null then; shownNow went to holdForEndedFade's non-null parameter. Move the three fields above init. ChatRequestsViewModelTest builds the ViewModel with an unconfined main dispatcher, which reproduces the in-place emission and failed with the same NPE before the move. Bugsnag: 6ae37ae9c6c10d79fad03c42
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.
Opening a group chat on internal 2026.10.5 (4951) crashes with
NullPointerExceptioninholdForEndedFade(Bugsnag 6ae37ae9c6c10d79fad03c42). #1877 introduced the bug; production 2026.10.3 doesn't include that change.viewModelScoperuns onMain.immediate, so the deck collector started inChatRequestsViewModel'sinitpublishes before the constructor returns. The crash stack shows it:<init>:70→launch→combine→emit:76→publish:104.shownNow,settleandsettledDeckwere declared afterinit, so they were still null at that point.shownNowwas passed toholdForEndedFade's non-null parameter, and the null check threw.This PR moves the three fields above
init. The newChatRequestsViewModelTestbuilds the ViewModel with an unconfined main dispatcher, which reproduces the in-place emission. Before the move, the test failed withParameter specified as non-null is null: ... holdForEndedFade, parameter shownNow.