diff --git a/ResourceMonitor/Components/ResourceMonitorLogic.cs b/ResourceMonitor/Components/ResourceMonitorLogic.cs index 1317fe5..a472391 100644 --- a/ResourceMonitor/Components/ResourceMonitorLogic.cs +++ b/ResourceMonitor/Components/ResourceMonitorLogic.cs @@ -66,6 +66,7 @@ private void TrackExistingStorageContainers() public void AlertedNewStorageContainerPlaced(StorageContainer sc) { + System.Console.WriteLine("[ERROR] sc is null ? " + (sc == null ? "its null" : "its not null")); StartCoroutine("TrackNewStorageContainerCoroutine", sc); } diff --git a/ResourceMonitor/Patchers/BuilderPatcher.cs b/ResourceMonitor/Patchers/BuilderPatcher.cs index d8b3bed..0fc24b6 100644 --- a/ResourceMonitor/Patchers/BuilderPatcher.cs +++ b/ResourceMonitor/Patchers/BuilderPatcher.cs @@ -15,7 +15,10 @@ public class BuilderPatcher [HarmonyPostfix] public static void Postfix(StorageContainer __instance) { - OnStorageContainedAdded.Invoke(__instance); + if (OnStorageContainedAdded != null) + { + OnStorageContainedAdded.Invoke(__instance); + } } } }