Skip to content

Fix NPE in VMatchUI.populate when cellWithHands is null#9875

Merged
tool4ever merged 1 commit intoCard-Forge:masterfrom
MostCromulent:fix-cellWithHands-npe
Feb 22, 2026
Merged

Fix NPE in VMatchUI.populate when cellWithHands is null#9875
tool4ever merged 1 commit intoCard-Forge:masterfrom
MostCromulent:fix-cellWithHands-npe

Conversation

@MostCromulent
Copy link
Contributor

Summary

Fixes the crash on game start reported by smokeweedle on Discord, caused by a null cellWithHands in VMatchUI.populate().

#9637 added isShowing() checks to the hand discovery loop so that after a layout refresh, hands wouldn't get placed into stale cells that existed in memory but were no longer part of the visible layout. However, these same checks can also reject perfectly valid cells during initial game load — before Swing has fully realized the components, or when the user's saved layout is missing expected panels like REPORT_LOG. When every cell fails the isShowing() check and all fallbacks return null, the game crashes with:

java.lang.NullPointerException: Cannot invoke "forge.gui.framework.DragCell.addDoc(forge.gui.framework.IVDoc)" because "cellWithHands" is null
    at forge.screens.match.VMatchUI.populate(VMatchUI.java:244)

The fix adds a last-resort fallback that remembers any existing hand cell even if not yet showing. If every fallback still somehow returns null, the hand placement is skipped rather than crashing — the hand panel will appear on the next layout refresh or repopulate call.


🤖 Generated with Claude Code

The isShowing() checks added in 56ba728 can cause cellWithHands to
be null during initial game load (before Swing has realized components)
or when the user's saved layout is missing expected panels. Add a
fallback chain that remembers any existing hand cell even if not yet
showing, and guard against null at the addDoc call site.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tool4ever tool4ever merged commit b07fdfe into Card-Forge:master Feb 22, 2026
2 checks passed
@MostCromulent MostCromulent deleted the fix-cellWithHands-npe branch February 23, 2026 20:39
clairchiara pushed a commit to clairchiara/forge that referenced this pull request Feb 28, 2026
)

The isShowing() checks added in 56ba728 can cause cellWithHands to
be null during initial game load (before Swing has realized components)
or when the user's saved layout is missing expected panels. Add a
fallback chain that remembers any existing hand cell even if not yet
showing, and guard against null at the addDoc call site.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants