
Version: public_beta as of Nov 18, 2025
This is a couple bugs with the Hand Select Mode, and the fixes necessary to resolve them.
All fix code has been tested.
— Hotseat NullReferenceException —
Passing the turn in a hotseat game while the Hand Select Mode is active throws a NullReferenceException in HandZone.PositionHandObjects at IL offset 0x05cb, which refers to the static field load (ldsfld) of PlayerScript.PointerScript in the following code:
Singleton<HandSelectMode>.Instance.IsActive && this == HandZone.GetHandZone(PlayerScript.PointerScript.PointerColorLabel, 0, false);(note this is decompiled code so it may not match exactly)
Because hotseat player pointers cease to exist when the turn changes, a NullReferenceException is thrown.
To reproduce:
lua chooseInHand("first", 1, 1, "first!", { "White" })Fix:
in the HandZone.PositionHandObjects method, when checking for:
HandSelectMode is activeHandZone is the same as hand zone 0 for the pointer PlayerScript.PointerScriptadd a null check:
Singleton<HandSelectMode>.Instance.IsActive && PlayerScript.PointerScript != null && this == HandZone.GetHandZone(PlayerScript.PointerScript.PointerColorLabel, 0, false);— Queued hand selections cause problems —
Starting another hand selection while one is currently in progress for a given player causes issues.
This seems to be because the active hand zone is cleared after the next item in the queue is loaded, causing a broken state.
To reproduce:
lua function onPlayerHandChoice(_, label, _, _) log(label) endlua chooseInHand("first", 1, 1, "first!", { "White" })lua chooseInHand("second", 1, 1, "second!", { "White" })lua chooseInHand("third", 1, 1, "third!", { "White" })lua chooseInHand("fourth", 1, 1, "fourth!", { "White" })Fix:
in the HandSelectMode.EndHandSelectMode method, move these two operations:
selectedNPOs.Clear();
this.ActiveHandZone = null;above the if(doCallback) { ... } block, and before zeroing ActiveHandZone, store the reference in a local, so you can use it in the doCallback if statement:
this.selectedNPOs.Clear();
HandZone hz = this.ActiveHandZone;
this.ActiveHandZone = null;
if (doCallback)
{
List<LuaGameObjectScript> list = (confirmed ? this.selectedNPOs.ToLGOS((NetworkPhysicsObject npo) => hz.ContainedNPOs.Contains(npo)) : new List<LuaGameObjectScript>());
if (this.preset == null)
{
EventManager.TriggerHandSelectModeEnd(hz.TriggerLabel, this.label, list, confirmed);
}
hz.EndHandSelectMode();
}

