1
0
Fork 0

Controls: ensure engine index is valid

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.
This commit is contained in:
James Turner 2021-05-24 15:54:17 +01:00
parent bc4a2b3ab7
commit a702fd7b27

View file

@ -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();
}
}