From 3af538bd87575d2b7ecdcdd1f204220d6a7df882 Mon Sep 17 00:00:00 2001 From: EvilFactory Date: Thu, 19 Oct 2023 14:32:17 -0300 Subject: [PATCH] Fixed NRE with status effect luahook --- .../SharedSource/StatusEffects/StatusEffect.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs b/Barotrauma/BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs index 2ed0b0eed..bde5ce676 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs @@ -1565,12 +1565,15 @@ namespace Barotrauma } } - foreach (string luaHooks in luaHook) + if (luaHook != null) { - var result = GameMain.LuaCs.Hook.Call(luaHooks, this, deltaTime, entity, targets, worldPosition); + foreach (string luaHooks in luaHook) + { + var result = GameMain.LuaCs.Hook.Call(luaHooks, this, deltaTime, entity, targets, worldPosition); - if (result != null && result.Value) - return; + if (result != null && result.Value) + return; + } } Hull hull = GetHull(entity); @@ -2590,4 +2593,4 @@ namespace Barotrauma return tags.Contains(tag) || tags.Contains(tag); } } -} \ No newline at end of file +}