Day 327: Still haven't managed to fix rare NRE that happens with timers

Starting to run out of food.
This commit is contained in:
EvilFactory
2022-11-03 21:07:29 -03:00
parent dbc67cc489
commit f7b046e950
@@ -66,6 +66,8 @@ namespace Barotrauma
} }
public void Update() public void Update()
{
try
{ {
List<TimedAction> timedActionsToRemove = new List<TimedAction>(); List<TimedAction> timedActionsToRemove = new List<TimedAction>();
for (int i = 0; i < timedActions.Count; i++) for (int i = 0; i < timedActions.Count; i++)
@@ -95,6 +97,12 @@ namespace Barotrauma
timedActions.Remove(timedAction); timedActions.Remove(timedAction);
} }
} }
catch (NullReferenceException e)
{
GameMain.LuaCs.PrintError("Error while executing timers... This shouldn't happen... Why do we a NRE here???", LuaCsMessageOrigin.Unknown);
GameMain.LuaCs.HandleException(e, LuaCsMessageOrigin.Unknown);
}
}
public void Clear() public void Clear()
{ {