From 3ddd20845ad5b5c29b879d1357c2c4de940cff36 Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Sat, 2 Mar 2024 14:50:28 +0800 Subject: [PATCH] crash fix --- UXAssist/FactoryPatch.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UXAssist/FactoryPatch.cs b/UXAssist/FactoryPatch.cs index f06b281..acebd26 100644 --- a/UXAssist/FactoryPatch.cs +++ b/UXAssist/FactoryPatch.cs @@ -167,11 +167,11 @@ public static class FactoryPatch return; } - if (_sail.enabled) + if (_sail && _sail.enabled) { _mechaOnEarth = false; Enabled = false; - if (_sunlight == null) return; + if (!_sunlight || !_sunlight.transform) return; _sunlight.transform.localEulerAngles = new Vector3(0f, 180f); _sunlight = null; return; @@ -179,19 +179,19 @@ public static class FactoryPatch if (!_mechaOnEarth) { - if (_sunlight == null) + if (!_sunlight) { var simu = GameMain.universeSimulator; if (simu) _sunlight = simu.LocalStarSimulator()?.sunLight; - if (_sunlight == null) return; + if (!_sunlight) return; } _mechaOnEarth = true; Enabled = NightLightEnabled.Value; } - if (Enabled) + if (Enabled && _sunlight) { _sunlight.transform.rotation = Quaternion.LookRotation(-GameMain.mainPlayer.transform.up + GameMain.mainPlayer.transform.forward * NightLightAngleX / 10f +