From e98f16c7169d74f7a4cf43bf8c77b009caf9e688 Mon Sep 17 00:00:00 2001 From: zeobviouslyfakeacc Date: Sat, 9 Feb 2019 17:56:43 +0100 Subject: [PATCH] Fix NRE caused by calls to ReadComplete when not reading --- Patches.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Patches.cs b/Patches.cs index 8914c9c..6519d63 100644 --- a/Patches.cs +++ b/Patches.cs @@ -69,6 +69,9 @@ private static void Prefix(Panel_Inventory_Examine __instance, ref int durationM [HarmonyPatch(typeof(Panel_Inventory_Examine), "ReadComplete", new Type[] { typeof(float) })] private static class ScaleReadComplete { private static void Prefix(Panel_Inventory_Examine __instance, ref float normalizedProgress) { + if (!__instance?.m_GearItem?.m_ResearchItem) + return; + int hoursToRead = Traverse.Create(__instance).Field("m_HoursToRead").GetValue(); float intervalsRead = normalizedProgress * hoursToRead; if (!Settings.GetAllowInterruptions()) {