Skip to content

Commit

Permalink
Fix crash on unknown LAN games (CnCNet#560)
Browse files Browse the repository at this point in the history
* Fix crash on unknown LAN games

* Fix incorrect culture in game identifier comparison
  • Loading branch information
SadPencil committed Oct 4, 2024
1 parent 982fde3 commit 44f72f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DXMainClient/DXGUI/Multiplayer/GameListBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private IEnumerable<GenericHostedGame> GetSortedGames()
var sortedGames =
HostedGames
.OrderBy(hg => hg.Locked)
.ThenBy(hg => string.Equals(hg.Game.InternalName, localGameIdentifier, StringComparison.CurrentCultureIgnoreCase))
.ThenBy(hg => string.Equals(hg.Game.InternalName, localGameIdentifier, StringComparison.InvariantCultureIgnoreCase))
.ThenBy(hg => hg.GameVersion != ProgramConstants.GAME_VERSION)
.ThenBy(hg => hg.Passworded);

Expand Down
2 changes: 2 additions & 0 deletions DXMainClient/Domain/Multiplayer/LAN/HostedLANGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public bool SetDataFromStringArray(GameCollection gc, string[] parameters)
GameVersion = parameters[1];
Incompatible = GameVersion != ProgramConstants.GAME_VERSION;
Game = gc.GameList.Find(g => g.InternalName.ToUpperInvariant() == parameters[2]);
if (Game == null)
return false;
Map = parameters[3];
GameMode = parameters[4];
LoadedGameID = parameters[5];
Expand Down

0 comments on commit 44f72f5

Please sign in to comment.