From a702fd7b27e8ab3b652725d071744427f3fc2d3e Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 24 May 2021 15:54:17 +0100 Subject: [PATCH] Controls: ensure engine index is valid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some spacecraft send out-of-range engine numbers from the JSBsim side. Should probably be fixed in JSBsim itself but let’s check here to keep compat with existing FDMs. --- src/Aircraft/controls.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Aircraft/controls.cxx b/src/Aircraft/controls.cxx index d22f81b6b..d2b197c18 100644 --- a/src/Aircraft/controls.cxx +++ b/src/Aircraft/controls.cxx @@ -1831,7 +1831,7 @@ void FGControls::fireEngineValueChanged(int index, simgear::PropertyList& props) std::for_each(props.begin(), props.end(), [](const SGPropertyNode_ptr &p) { p->fireValueChanged(); }); - } else { + } else if ((index >= 0) && (index < MAX_ENGINES)) { props.at(index)->fireValueChanged(); } }