Skip to content

fix(draft): prevent NPE when draft ends during pack-passing transition#10290

Open
billyhewlett wants to merge 1 commit intoCard-Forge:masterfrom
billyhewlett:fix/draft-end-npe
Open

fix(draft): prevent NPE when draft ends during pack-passing transition#10290
billyhewlett wants to merge 1 commit intoCard-Forge:masterfrom
billyhewlett:fix/draft-end-npe

Conversation

@billyhewlett
Copy link
Copy Markdown

Problem

When the final round of a draft ends while packs are still being routed
between players, BoosterDraft.nextChoice() can return null. This is
expected and documented by a comment in DraftPackPage.refresh(). However,
the null-check block was missing a return statement, causing execution to
fall through to cardManager.setPool(null), throwing a NullPointerException.

The result: a crash/error screen appears at the end of the draft. The deck
save dialog still works, but the experience is alarming to users.

Root Cause

hasNextChoice() returns true when packs are still in transit between
players (round not yet over). nextChoice() processes those pass steps
internally via a recursive passPacks() call, which can drain all remaining
packs and return null if no new round can be started. The gap between the
two checks is where the null slips through.

Fix

Add return; after parentScreen.completeDraft() in the null-pool branch
of DraftPackPage.refresh().

Testing

Reproduce by completing any cube or custom draft to the final pick. The
crash screen no longer appears.

@tool4ever tool4ever requested a review from tehdiplomat April 5, 2026 07:39
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