Skip to content

Commit

Permalink
Fix OnGameOptionChanged crash on empty map
Browse files Browse the repository at this point in the history
  • Loading branch information
SadPencil committed Sep 19, 2024
1 parent 3cd0eb3 commit f247455
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,11 @@ protected override void OnGameOptionChanged()
{
base.OnGameOptionChanged();

// Don't broadcast game options if the current map or game mode is null.
// Don't worry about the game mode change. Upon a map is selected, OnGameOptionChanged() will be called again.
if (Map == null || GameMode == null)
return;

if (!IsHost)
return;

Expand Down
5 changes: 5 additions & 0 deletions DXMainClient/DXGUI/Multiplayer/GameLobby/LANGameLobby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,11 @@ protected override void OnGameOptionChanged()
{
base.OnGameOptionChanged();

// Don't broadcast game options if the current map or game mode is null.
// Don't worry about the game mode change. Upon a map is selected, OnGameOptionChanged() will be called again.
if (Map == null || GameMode == null)
return;

if (!IsHost)
return;

Expand Down

0 comments on commit f247455

Please sign in to comment.