Skip to content

Commit

Permalink
Fix custom map launch crash caused by missing UntranslatedName when m…
Browse files Browse the repository at this point in the history
…ap is loaded from cache
  • Loading branch information
Starkku committed Jul 28, 2023
1 parent a8ed284 commit da6aa4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions DXMainClient/Domain/Multiplayer/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,13 @@ public bool SetInfoFromCustomMap()
}
}

// Ran after the map has been loaded from cache if it is a custom map.
public void AfterDeserialize()
{
CalculateSHA();
UntranslatedName = Name;
}

private void ParseForcedOptions(IniFile iniFile, string forcedOptionsSection)
{
List<string> keys = iniFile.GetSectionKeys(forcedOptionsSection);
Expand Down
2 changes: 1 addition & 1 deletion DXMainClient/Domain/Multiplayer/MapLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private ConcurrentDictionary<string, Map> LoadCustomMapCache()
? customMapCache.Maps : new ConcurrentDictionary<string, Map>();

foreach (var customMap in customMaps.Values)
customMap.CalculateSHA();
customMap.AfterDeserialize();

return customMaps;
}
Expand Down

0 comments on commit da6aa4d

Please sign in to comment.