fix error not being handled if name is null

This commit is contained in:
Evil Factory
2022-07-03 12:41:15 -03:00
parent 57032eeb11
commit aaa27229cf

View File

@@ -98,13 +98,13 @@ namespace Barotrauma
public void Add(string name, string hookName, LuaCsFunc hook, ACsMod owner = null)
{
name = name.ToLower();
if (name == null || hookName == null || hook == null)
{
throw new ScriptRuntimeException("Hook.Add: name, hookName and hook must not be null.");
}
name = name.ToLower();
if (!hookFunctions.ContainsKey(name))
{
hookFunctions.Add(name, new Dictionary<string, (LuaCsHookCallback, ACsMod)>());