From e27c899c17e2aa32c95de16d3dbbf623a122ad31 Mon Sep 17 00:00:00 2001 From: templeofshadow Date: Mon, 29 Jun 2026 16:13:43 -0500 Subject: [PATCH] add nil check for main SensorData subtables (but not values in those subtables) --- main.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.lua b/main.lua index a21801c..9822d7b 100644 --- a/main.lua +++ b/main.lua @@ -771,6 +771,10 @@ function UpdateGlobalThrust() local dt = GetDeltaTime() + if SensorData.Gimbal == nil or SensorData.Altitude == nil or SensorData.Velocity == nil then + print("ERROR: One or more of SensorData is nil. Cannot update thrust.") + return + end local throttleOutput = PIDs.AltitudePID:update(Config.Autopilot.AutopilotDesiredAltitude or 0, SensorData.Altitude.Altitude or 0, dt)