diff --git a/CheatEnabler/Patches/GamePatch.cs b/CheatEnabler/Patches/GamePatch.cs index c3f9ea9..8725a22 100644 --- a/CheatEnabler/Patches/GamePatch.cs +++ b/CheatEnabler/Patches/GamePatch.cs @@ -54,7 +54,8 @@ public static class GamePatch protected override void OnDisable() { if (_savedDeterminators == null) return; - var abnormalLogic = GameMain.gameScenario.abnormalityLogic; + var abnormalLogic = GameMain.gameScenario?.abnormalityLogic; + if (abnormalLogic?.determinators == null) return; abnormalLogic.determinators = _savedDeterminators; foreach (var p in _savedDeterminators) { diff --git a/Dustbin/Dustbin.cs b/Dustbin/Dustbin.cs index 8158cff..eb8d15e 100644 --- a/Dustbin/Dustbin.cs +++ b/Dustbin/Dustbin.cs @@ -48,7 +48,7 @@ public class Dustbin : BaseUnityPlugin, IModCanSave, IMultiplayerMod NebulaModAPI.RegisterPackets(Assembly.GetExecutingAssembly()); NebulaModAPI.OnPlanetLoadFinished += RequestPlanetDustbinData; } - + private void OnDestroy() { TankPatch.Enable(false); @@ -68,7 +68,7 @@ public class Dustbin : BaseUnityPlugin, IModCanSave, IMultiplayerMod return count; } - #region IModCanSave + #region IModCanSave private const ushort ModSaveVersion = 1; public void Export(BinaryWriter w)