From c5976ccae19ad03ed8370e6a0dee985132a18ccc Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Sat, 11 Apr 2026 23:32:40 -0300 Subject: [PATCH] Add safety check so this stops crashing when we look at it the wrong way --- .../BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs index c139166dc..195bd5c58 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs @@ -99,7 +99,15 @@ namespace Barotrauma internal set { _isCsEnabledForSession?.TrySetValue(value); - if (_isCsEnabledForSession != null) { ConfigService.SaveConfigValue(_isCsEnabledForSession); } + if (_isCsEnabledForSession != null) + { + if (_isCsEnabledForSession.GetConfigInfo() == null) + { + Logger.LogError($"Config info was nil while trying to save {IsCsEnabledForSession}"); + return; + } + ConfigService.SaveConfigValue(_isCsEnabledForSession); + } } }