forked from nikita/muzika-gromche
Guard against null during shutdown
This commit is contained in:
parent
a71c61b5c7
commit
871c608a33
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue