Skip to content

Commit ac044f7

Browse files
authored
Fix crash on unknown LAN games (#560)
* Fix crash on unknown LAN games * Fix incorrect culture in game identifier comparison
1 parent 7f9991f commit ac044f7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

DXMainClient/DXGUI/Multiplayer/GameListBox.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private IEnumerable<GenericHostedGame> GetSortedGames()
128128
var sortedGames =
129129
HostedGames
130130
.OrderBy(hg => hg.Locked)
131-
.ThenBy(hg => string.Equals(hg.Game.InternalName, localGameIdentifier, StringComparison.CurrentCultureIgnoreCase))
131+
.ThenBy(hg => string.Equals(hg.Game.InternalName, localGameIdentifier, StringComparison.InvariantCultureIgnoreCase))
132132
.ThenBy(hg => hg.GameVersion != ProgramConstants.GAME_VERSION)
133133
.ThenBy(hg => hg.Passworded);
134134

DXMainClient/Domain/Multiplayer/LAN/HostedLANGame.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public bool SetDataFromStringArray(GameCollection gc, string[] parameters)
3636
GameVersion = parameters[1];
3737
Incompatible = GameVersion != ProgramConstants.GAME_VERSION;
3838
Game = gc.GameList.Find(g => g.InternalName.ToUpperInvariant() == parameters[2]);
39+
if (Game == null)
40+
return false;
3941
Map = parameters[3];
4042
GameMode = parameters[4];
4143
LoadedGameID = parameters[5];

0 commit comments

Comments
 (0)