Fix #106 turn list into an array before looping through hooks
This commit is contained in:
@@ -759,12 +759,12 @@ namespace Barotrauma
|
||||
|
||||
T lastResult = default;
|
||||
|
||||
var hooksToRemove = new List<string>();
|
||||
foreach ((var key, var tuple) in hookFunctions[name])
|
||||
var hooks = hookFunctions[name].ToArray();
|
||||
foreach ((string key, var tuple) in hooks)
|
||||
{
|
||||
if (tuple.Item2 != null && tuple.Item2.IsDisposed)
|
||||
{
|
||||
hooksToRemove.Add(key);
|
||||
hookFunctions[name].Remove(key);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -804,10 +804,6 @@ namespace Barotrauma
|
||||
luaCs.HandleException(e, LuaCsMessageOrigin.Unknown);
|
||||
}
|
||||
}
|
||||
foreach (var key in hooksToRemove)
|
||||
{
|
||||
hookFunctions[name].Remove(key);
|
||||
}
|
||||
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user