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;
|
T lastResult = default;
|
||||||
|
|
||||||
var hooksToRemove = new List<string>();
|
var hooks = hookFunctions[name].ToArray();
|
||||||
foreach ((var key, var tuple) in hookFunctions[name])
|
foreach ((string key, var tuple) in hooks)
|
||||||
{
|
{
|
||||||
if (tuple.Item2 != null && tuple.Item2.IsDisposed)
|
if (tuple.Item2 != null && tuple.Item2.IsDisposed)
|
||||||
{
|
{
|
||||||
hooksToRemove.Add(key);
|
hookFunctions[name].Remove(key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -804,10 +804,6 @@ namespace Barotrauma
|
|||||||
luaCs.HandleException(e, LuaCsMessageOrigin.Unknown);
|
luaCs.HandleException(e, LuaCsMessageOrigin.Unknown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (var key in hooksToRemove)
|
|
||||||
{
|
|
||||||
hookFunctions[name].Remove(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
return lastResult;
|
return lastResult;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user