From af1a454820404f0013f1ebc3a15068b26d339e5d Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 28 Jan 2022 15:56:24 +1100 Subject: [PATCH] SITL: fix may-be-used-uninitialised error in thermalling code --- libraries/SITL/SIM_Aircraft.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/SITL/SIM_Aircraft.cpp b/libraries/SITL/SIM_Aircraft.cpp index 15c055f89f..04d0c2456c 100644 --- a/libraries/SITL/SIM_Aircraft.cpp +++ b/libraries/SITL/SIM_Aircraft.cpp @@ -35,6 +35,7 @@ #include #include #include +#include using namespace SITL; @@ -1033,6 +1034,8 @@ float Aircraft::get_local_updraft(const Vector3d ¤tPos) int n_thermals = 0; switch (scenario) { + case 0: + return 0; case 1: n_thermals = 1; thermals_w[0] = 2.0; @@ -1054,6 +1057,8 @@ float Aircraft::get_local_updraft(const Vector3d ¤tPos) thermals_x[0] = -180.0; thermals_y[0] = -260.0; break; + default: + AP_BoardConfig::config_error("Bad thermal scenario"); } // Wind drift at this altitude