Skip to content

Fix #1643: Null checks for card deletion and empty card arrays#2313

Open
kellyelton wants to merge 1 commit intomasterfrom
oi/1643/fix-null-delete-card
Open

Fix #1643: Null checks for card deletion and empty card arrays#2313
kellyelton wants to merge 1 commit intomasterfrom
oi/1643/fix-null-delete-card

Conversation

@kellyelton
Copy link
Copy Markdown
Member

Fixes #1643 - NullPointer during removal of a card

Two crash fixes:

  1. NullReferenceException in DeleteCard: When a card is deleted and its Group is already null, the code would crash trying to call card.Group.Remove(card). Added a null check.

  2. IndexOutOfRangeException in MoveCard: When all cards in a move request fail to resolve via Card.Find(), the empty array was passed to MoveCards constructor which accesses cards[0].Group. Added an empty array guard.

Both fixes are defensive null/empty checks that prevent crashes during networked play.

…eCard

- Add null check for card.Group in DeleteCard to prevent NullReferenceException
- Add empty array check in MoveCard to prevent IndexOutOfRangeException when all cards fail to resolve
@kellyelton kellyelton added the octgn-issue-bot PRs created by the OCTGN issue bot label Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

octgn-issue-bot PRs created by the OCTGN issue bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullPointer during removal of a card

1 participant