Skip to content

Commit

Permalink
Added try catch to catch rare case of player not being in sandbox fil…
Browse files Browse the repository at this point in the history
…e OR gps being deleted before loading.
  • Loading branch information
thorwin99 committed Jul 10, 2022
1 parent 29db853 commit e9ab7f6
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions SEWorldGenPlugin/Session/MyGPSManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,23 @@ public override void UpdateBeforeSimulation()
{
foreach (var gps in player.DynamicGpss)
{
var collection = MySession.Static.Gpss[player.PlayerId];
var mgps = collection[gps.Hash];
try
{
var collection = MySession.Static.Gpss[player.PlayerId];

if (collection == null) continue;

var mgps = collection[gps.Hash];

if (mgps == null) continue;
if (mgps == null) continue;

m_dynamicGpss.Add(new MyDynamicGpsId(gps.ID, player.PlayerId), mgps);
m_dynamicGpss.Add(new MyDynamicGpsId(gps.ID, player.PlayerId), mgps);
}
catch (KeyNotFoundException)
{
MyPluginLog.Log("Could not load dynamic GPS " + gps.ID + " for player " + player.PlayerId, LogLevel.ERROR);
continue;
}
}
}
loadedDynamicGpss = true;
Expand Down

0 comments on commit e9ab7f6

Please sign in to comment.