add nil check for main SensorData subtables (but not values in those subtables)

This commit is contained in:
2026-06-29 16:13:43 -05:00
parent e69c370c97
commit e27c899c17

View File

@@ -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)