attempt in fixing mysterious timer crash again
This commit is contained in:
@@ -59,24 +59,21 @@ namespace Barotrauma
|
||||
|
||||
public void Update()
|
||||
{
|
||||
while (timedActions.Count > 0)
|
||||
List<TimedAction> timedActionsToRemove = new List<TimedAction>();
|
||||
for (int i = 0; i < timedActions.Count; i++)
|
||||
{
|
||||
if (timedActions == null)
|
||||
{
|
||||
throw new Exception($"timedActions was null, how is this possible? On MainThread: {GameMain.MainThread == System.Threading.Thread.CurrentThread}");
|
||||
}
|
||||
|
||||
TimedAction timedAction = timedActions[0];
|
||||
if (Time >= timedAction.executionTime)
|
||||
{
|
||||
timedAction.action();
|
||||
timedActions.RemoveAt(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
timedActionsToRemove.Add(timedAction);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (TimedAction timedAction in timedActionsToRemove)
|
||||
{
|
||||
timedActions.Remove(timedAction);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
|
||||
Reference in New Issue
Block a user