From cfd79602d574f1506e5b967ba97053462a3ff22c Mon Sep 17 00:00:00 2001 From: Simon <9026685+simonmeulenbeek@users.noreply.github.com> Date: Thu, 23 Apr 2020 22:05:10 +0200 Subject: [PATCH] NRE fix The old code could lead to a null reference exception if `debugAppButton = null` and `debug = false` --- .../SSTUTools/KSPShaderTools/Addon/TexturesUnlimitedDebug.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Plugin/SSTUTools/KSPShaderTools/Addon/TexturesUnlimitedDebug.cs b/Plugin/SSTUTools/KSPShaderTools/Addon/TexturesUnlimitedDebug.cs index 07db512..c3ca176 100644 --- a/Plugin/SSTUTools/KSPShaderTools/Addon/TexturesUnlimitedDebug.cs +++ b/Plugin/SSTUTools/KSPShaderTools/Addon/TexturesUnlimitedDebug.cs @@ -36,7 +36,10 @@ public void Awake() } else//button not null, but not debug mode; needs to be removed { - ApplicationLauncher.Instance.RemoveModApplication(debugAppButton); + if (debugAppButton != null) + { + ApplicationLauncher.Instance.RemoveModApplication(debugAppButton); + } } }