Skip to content

Commit 01787a7

Browse files
committed
added null guards
1 parent 71defda commit 01787a7

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/CWX-MegaMod/MegaMod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace CWX_MegaMod
1212
{
13-
[BepInPlugin("CWX.MegaMod", "CWX-MegaMod", "1.2.0")]
13+
[BepInPlugin("CWX.MegaMod", "CWX-MegaMod", "1.2.1")]
1414
public class MegaMod : BaseUnityPlugin
1515
{
1616
internal new static ManualLogSource Logger { get; private set; }

src/CWX-MegaMod/WeathePatcher/WeatherPatcherScopePatch.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,23 @@ public static void PatchPostfix(ref OpticComponentUpdater __instance)
2121
WeatherPatcherScript.ScopeScattering = __instance.gameObject.GetComponent<TOD_Scattering>();
2222
WeatherPatcherScript.ScopeMboit = __instance.gameObject.GetComponent<MBOIT_Scattering>();
2323

24-
if (WeatherPatcherScript.ScopeGlobalFog != null &&
25-
WeatherPatcherScript.ScopeScattering != null &&
26-
WeatherPatcherScript.ScopeMboit != null)
27-
{
28-
WeatherPatcherScript.ScopeRunOnce = true;
29-
}
24+
WeatherPatcherScript.ScopeRunOnce = true;
3025
}
3126

32-
WeatherPatcherScript.ScopeGlobalFog.enabled = !MegaMod.FogRemover.Value;
33-
WeatherPatcherScript.ScopeScattering.enabled = !MegaMod.FogRemover.Value;
34-
WeatherPatcherScript.ScopeMboit.enabled = !MegaMod.FogRemover.Value;
27+
if (WeatherPatcherScript.ScopeGlobalFog != null)
28+
{
29+
WeatherPatcherScript.ScopeGlobalFog.enabled = !MegaMod.FogRemover.Value;
30+
}
31+
32+
if (WeatherPatcherScript.ScopeScattering != null)
33+
{
34+
WeatherPatcherScript.ScopeScattering.enabled = !MegaMod.FogRemover.Value;
35+
}
36+
37+
if (WeatherPatcherScript.ScopeMboit != null)
38+
{
39+
WeatherPatcherScript.ScopeMboit.enabled = !MegaMod.FogRemover.Value;
40+
}
3541
}
3642
}
3743
}

0 commit comments

Comments
 (0)