diff --git a/MuzikaGromche/DiscoBallManager.cs b/MuzikaGromche/DiscoBallManager.cs index af5c19d..4e4dd19 100644 --- a/MuzikaGromche/DiscoBallManager.cs +++ b/MuzikaGromche/DiscoBallManager.cs @@ -113,11 +113,17 @@ namespace MuzikaGromche foreach (var discoBall in CachedDiscoBalls) { - discoBall.SetActive(on); + if (discoBall != null) + { + discoBall.SetActive(on); + } } foreach (var animator in CachedDiscoBallAnimators) { - animator?.SetBool("on", on); + if (animator != null) + { + animator.SetBool("on", on); + } } } diff --git a/MuzikaGromche/PoweredLights.cs b/MuzikaGromche/PoweredLights.cs index 71fdbf6..ac53f8d 100644 --- a/MuzikaGromche/PoweredLights.cs +++ b/MuzikaGromche/PoweredLights.cs @@ -68,7 +68,11 @@ namespace MuzikaGromche { foreach (var data in AllPoweredLights) { - data.Light.color = data.InitialColor; + var light = data.Light; + if (light != null) + { + light.color = data.InitialColor; + } } } } diff --git a/MuzikaGromche/ScreenFiltersManager.cs b/MuzikaGromche/ScreenFiltersManager.cs index 2f31370..eeb4707 100644 --- a/MuzikaGromche/ScreenFiltersManager.cs +++ b/MuzikaGromche/ScreenFiltersManager.cs @@ -120,7 +120,9 @@ namespace MuzikaGromche { drunkness = 0f; // Only the stop animation if vanilla doesn't animate TZP right now. - if (GameNetworkManager.Instance.localPlayerController.drunkness == 0f) + // Objects may be null on shutdown + var network = GameNetworkManager.Instance; + if (network != null && network.localPlayerController != null && network.localPlayerController.drunkness == 0f) { HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", value: false); }