From b92c3dc57e75e7fc88fa1891f81304e481f342e1 Mon Sep 17 00:00:00 2001 From: Manuel McLure Date: Thu, 5 Sep 2024 15:05:46 -0700 Subject: [PATCH] Don't crash if innerException is null (#642) * Don't crash if innerException is null * Log outer exception if InnerException is null --------- Co-authored-by: Tal Zaccai --- libs/server/Lua/LuaCommands.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/server/Lua/LuaCommands.cs b/libs/server/Lua/LuaCommands.cs index 94dd76f027..231604e6d7 100644 --- a/libs/server/Lua/LuaCommands.cs +++ b/libs/server/Lua/LuaCommands.cs @@ -231,8 +231,8 @@ private unsafe bool ExecuteScript(int count, LuaRunner scriptRunner) } catch (LuaScriptException ex) { - logger?.LogError(ex.InnerException, "Error executing Lua script callback"); - while (!RespWriteUtils.WriteError("ERR " + ex.InnerException.Message, ref dcurr, dend)) + logger?.LogError(ex.InnerException ?? ex, "Error executing Lua script callback"); + while (!RespWriteUtils.WriteError("ERR " + (ex.InnerException ?? ex).Message, ref dcurr, dend)) SendAndReset(); return true; }