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:
@@ -67,32 +67,40 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
List<TimedAction> timedActionsToRemove = new List<TimedAction>();
|
try
|
||||||
for (int i = 0; i < timedActions.Count; i++)
|
|
||||||
{
|
{
|
||||||
TimedAction timedAction = timedActions[i];
|
List<TimedAction> timedActionsToRemove = new List<TimedAction>();
|
||||||
if (Time >= timedAction.ExecutionTime)
|
for (int i = 0; i < timedActions.Count; i++)
|
||||||
{
|
{
|
||||||
try
|
TimedAction timedAction = timedActions[i];
|
||||||
|
if (Time >= timedAction.ExecutionTime)
|
||||||
{
|
{
|
||||||
timedAction.Action();
|
try
|
||||||
}
|
{
|
||||||
catch (Exception e)
|
timedAction.Action();
|
||||||
{
|
}
|
||||||
GameMain.LuaCs.HandleException(e, LuaCsMessageOrigin.CSharpMod);
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
|
GameMain.LuaCs.HandleException(e, LuaCsMessageOrigin.CSharpMod);
|
||||||
|
}
|
||||||
|
|
||||||
timedActionsToRemove.Add(timedAction);
|
timedActionsToRemove.Add(timedAction);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
foreach (TimedAction timedAction in timedActionsToRemove)
|
||||||
{
|
{
|
||||||
break;
|
timedActions.Remove(timedAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (NullReferenceException e)
|
||||||
foreach (TimedAction timedAction in timedActionsToRemove)
|
|
||||||
{
|
{
|
||||||
timedActions.Remove(timedAction);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user