From 8a983f18ce98e3f24a1ed74412183b54146e9298 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 29 Apr 2024 12:46:40 -0400 Subject: [PATCH] Fix an NRE I just got --- .../Components/Fixers/PlayerShipAtmosphereDetectorFix.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Components/Fixers/PlayerShipAtmosphereDetectorFix.cs b/NewHorizons/Components/Fixers/PlayerShipAtmosphereDetectorFix.cs index 25d135c1..1eb440d9 100644 --- a/NewHorizons/Components/Fixers/PlayerShipAtmosphereDetectorFix.cs +++ b/NewHorizons/Components/Fixers/PlayerShipAtmosphereDetectorFix.cs @@ -14,7 +14,11 @@ internal class PlayerShipAtmosphereDetectorFix : MonoBehaviour public void Start() { _fluidDetector = Locator.GetPlayerCameraDetector().GetComponent(); - _shipAtmosphereVolume = Locator.GetShipBody().transform.Find("Volumes/ShipAtmosphereVolume").GetComponent(); + _shipAtmosphereVolume = Locator.GetShipBody()?.transform?.Find("Volumes/ShipAtmosphereVolume")?.GetComponent(); + if (_shipAtmosphereVolume == null) + { + Destroy(this); + } } public void Update()