fix(cpn): function switches induced crash (#5620)

This commit is contained in:
Neil Horne
2024-10-18 09:03:19 +10:00
committed by GitHub
parent e8224b8f08
commit 1056ae22c4
2 changed files with 12 additions and 12 deletions
@@ -132,7 +132,7 @@ QString CustomFunctionData::funcToString(const AssignFunc func, const ModelData
return tr("RGB leds");
else if (func == FuncLCDtoVideo)
return tr("LCD to Video");
else if (func >= FuncPushCustomSwitch1 && func <= FuncPushCustomSwitchLast) {
else if (func >= FuncPushCustomSwitch1 && func <= FuncPushCustomSwitchLast && Boards::getCapability(getCurrentBoard(), Board::FunctionSwitches)) {
const int idx = Boards::getSwitchTypeOffset(Board::SWITCH_FUNC) + func - FuncPushCustomSwitch1 + 1;
return tr("Push Custom Switch %1").arg(RawSource(SOURCE_TYPE_SWITCH, idx).toString(model));
}