Skip to content

Commit

Permalink
added null guards
Browse files Browse the repository at this point in the history
  • Loading branch information
CWXDEV committed Jun 21, 2024
1 parent 71defda commit 01787a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/CWX-MegaMod/MegaMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace CWX_MegaMod
{
[BepInPlugin("CWX.MegaMod", "CWX-MegaMod", "1.2.0")]
[BepInPlugin("CWX.MegaMod", "CWX-MegaMod", "1.2.1")]
public class MegaMod : BaseUnityPlugin
{
internal new static ManualLogSource Logger { get; private set; }
Expand Down
24 changes: 15 additions & 9 deletions src/CWX-MegaMod/WeathePatcher/WeatherPatcherScopePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,23 @@ public static void PatchPostfix(ref OpticComponentUpdater __instance)
WeatherPatcherScript.ScopeScattering = __instance.gameObject.GetComponent<TOD_Scattering>();
WeatherPatcherScript.ScopeMboit = __instance.gameObject.GetComponent<MBOIT_Scattering>();

if (WeatherPatcherScript.ScopeGlobalFog != null &&
WeatherPatcherScript.ScopeScattering != null &&
WeatherPatcherScript.ScopeMboit != null)
{
WeatherPatcherScript.ScopeRunOnce = true;
}
WeatherPatcherScript.ScopeRunOnce = true;
}

WeatherPatcherScript.ScopeGlobalFog.enabled = !MegaMod.FogRemover.Value;
WeatherPatcherScript.ScopeScattering.enabled = !MegaMod.FogRemover.Value;
WeatherPatcherScript.ScopeMboit.enabled = !MegaMod.FogRemover.Value;
if (WeatherPatcherScript.ScopeGlobalFog != null)
{
WeatherPatcherScript.ScopeGlobalFog.enabled = !MegaMod.FogRemover.Value;
}

if (WeatherPatcherScript.ScopeScattering != null)
{
WeatherPatcherScript.ScopeScattering.enabled = !MegaMod.FogRemover.Value;
}

if (WeatherPatcherScript.ScopeMboit != null)
{
WeatherPatcherScript.ScopeMboit.enabled = !MegaMod.FogRemover.Value;
}
}
}
}

0 comments on commit 01787a7

Please sign in to comment.