- Shipped
- September 8, 2026 at 2:58 PM UTC
- Author
- Kamo
- Commit
- 4d9a71f
Pressing New table answered 500: NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of HoldemTable.getButtonSeat() is null at **************** `HoldemHand.buttonSeat` is a primitive `int`; `HoldemTable.buttonSeat` is a nullable `Integer`, because a table has no button until it deals a hand. Written as `hand != null ? hand.getButtonSeat() : table.getButtonSeat()`, JLS 15.25 applies binary numeric promotion to the two branches and unboxes BOTH — so the expression calls `.intValue()` on the table's null before the result is ever assigned. Declaring the variable `Integer` does not help: the unboxing happens inside the conditional expression, and the assignment only re-boxes what survives. An if/else now, with a comment saying why, because the ternary is exactly the "simplification" somebody would reach for. This was the first thing anybody does with the feature, and it shipped. Every existing test had a hand in progress; not one built a view for the only state a brand-new table is ever in. `HoldemTableViewTest` builds three of them — empty, seated-but-not-dealt, and the lobby summary — and I confirmed all three reproduce the production NPE verbatim against the ternary before restoring the fix. It also pins two things the null button must NOT be allowed to invent: no dealer and no blind markers on a table that has not dealt, and no wallet round trip for a lobby row.