Skip to content

fix(requests): initialize deck fields before the collector runs - #1880

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/chat-requests-init-order
Oct 29, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
fix/chat-requests-init-order

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Opening a group chat on internal 2026.10.5 (4951) crashes with NullPointerException in holdForEndedFade (Bugsnag 6ae37ae9c6c10d79fad03c42). #1877 introduced the bug; production 2026.10.3 doesn't include that change.

viewModelScope runs on Main.immediate, so the deck collector started in ChatRequestsViewModel's init publishes before the constructor returns. The crash stack shows it: <init>:70 → launch → combine → emit:76 → publish:104. shownNow, settle and settledDeck were declared after init, so they were still null at that point. shownNow was passed to holdForEndedFade's non-null parameter, and the null check threw.

This PR moves the three fields above init. The new ChatRequestsViewModelTest builds the ViewModel with an unconfined main dispatcher, which reproduces the in-place emission. Before the move, the test failed with Parameter specified as non-null is null: ... holdForEndedFade, parameter shownNow.

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
@bmc08gt bmc08gt self-assigned this Oct 29, 2026
@github-actions github-actions Bot added the type: fix Bug fix label Oct 29, 2026
@bmc08gt
bmc08gt merged commit 0114b0f into code/cash Oct 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant