From aaa27229cf86ecd2ed60c3a30f3496839d3ba5f9 Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Sun, 3 Jul 2022 12:41:15 -0300 Subject: [PATCH] fix error not being handled if name is null --- Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs index b9a579ef3..c542a9272 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs @@ -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());