fix(cpn): crash when going into radio settings due to customisable switch groups source (#5141)

Unexpected side effect of #5016
This commit is contained in:
philmoz
2024-06-10 10:27:49 +10:00
committed by GitHub
parent 42153fbb84
commit aa87148fe9
3 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -294,7 +294,7 @@ bool RawSource::isAvailable(const ModelData * const model, const GeneralSettings
if (type == SOURCE_TYPE_CUSTOM_SWITCH && abs(index) > CPN_MAX_LOGICAL_SWITCHES)
return false;
if (type == SOURCE_TYPE_FUNCTIONSWITCH_GROUP && model->getFuncGroupSwitchCount(abs(index), CPN_MAX_SWITCHES_FUNCTION) == 0)
if (type == SOURCE_TYPE_FUNCTIONSWITCH_GROUP && b.getCapability(Board::FunctionSwitches) && model->getFuncGroupSwitchCount(abs(index), CPN_MAX_SWITCHES_FUNCTION) == 0)
return false;
if (type == SOURCE_TYPE_LUA_OUTPUT && div(abs(index - 1), 16).quot >= CPN_MAX_SCRIPTS)