Skip to content

Fix #2212: Add null check for Player.AllExceptGlobal to prevent InvalidOperationException when no players exist#2330

Open
kellyelton wants to merge 1 commit intomasterfrom
oi/2238/arkham-horror-spirit-speaker-bug
Open

Fix #2212: Add null check for Player.AllExceptGlobal to prevent InvalidOperationException when no players exist#2330
kellyelton wants to merge 1 commit intomasterfrom
oi/2238/arkham-horror-spirit-speaker-bug

Conversation

@kellyelton
Copy link
Copy Markdown
Member

Fixes #2212

This PR fixes the 'Sequence contains no elements' exception that was preventing users from starting games when no players were available except the global player.

Changes Made

  • Added check before calling on in
  • This prevents the InvalidOperationException from occurring when there are no players except the global player

Test

  • The fix ensures that when no players are present, the code simply skips setting the host controller instead of crashing
  • This matches the expected behavior when starting with only the global player

…idOperationException when no players exist

- Added Any() check before calling First() to prevent 'Sequence contains no elements' exception
- This prevents PreGameLobby.Start() from crashing when there are no players except the global player
@kellyelton kellyelton added the octgn-issue-bot PRs created by the OCTGN issue bot label Mar 31, 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.

Can't start any game.

1 participant