Skip to content

Commit

Permalink
Merge pull request #3496 from HebaruSan/fix/inst-crash
Browse files Browse the repository at this point in the history
Log error and recover on instance loading exception
  • Loading branch information
techman83 authored Dec 23, 2021
2 parents cafa832 + 8143492 commit 136c26d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Core/GameInstanceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,20 @@ private void LoadInstances()
var name = instance.Item1;
var path = instance.Item2;
var gameName = instance.Item3;
var game = knownGames.FirstOrDefault(g => g.ShortName == gameName)
?? knownGames[0];
log.DebugFormat("Loading {0} from {1}", name, path);
// Add unconditionally, sort out invalid instances downstream
instances.Add(name, new GameInstance(game, path, name, User));
try
{
var game = knownGames.FirstOrDefault(g => g.ShortName == gameName)
?? knownGames[0];
log.DebugFormat("Loading {0} from {1}", name, path);
// Add unconditionally, sort out invalid instances downstream
instances.Add(name, new GameInstance(game, path, name, User));
}
catch (Exception exc)
{
// Skip malformed instances (e.g. empty path)
log.Error($"Failed to load game instance with name=\"{name}\" path=\"{path}\" game=\"{gameName}\"",
exc);
}
}
}

Expand Down

0 comments on commit 136c26d

Please sign in to comment.