[Companion] Fix another possible crash during model conversions (divide by zero).
This commit is contained in:
@@ -699,6 +699,8 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen
|
|||||||
return QObject::tr("L%1").arg(index);
|
return QObject::tr("L%1").arg(index);
|
||||||
|
|
||||||
case SWITCH_TYPE_MULTIPOS_POT:
|
case SWITCH_TYPE_MULTIPOS_POT:
|
||||||
|
if (!getCurrentFirmware()->getCapability(MultiposPotsPositions))
|
||||||
|
return QObject::tr("???");
|
||||||
qr = div(index - 1, getCurrentFirmware()->getCapability(MultiposPotsPositions));
|
qr = div(index - 1, getCurrentFirmware()->getCapability(MultiposPotsPositions));
|
||||||
if (generalSettings && qr.quot < (int)DIM(generalSettings->potConfig))
|
if (generalSettings && qr.quot < (int)DIM(generalSettings->potConfig))
|
||||||
swName = QString(generalSettings->potName[qr.quot]);
|
swName = QString(generalSettings->potName[qr.quot]);
|
||||||
|
|||||||
Reference in New Issue
Block a user