1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 16:25:16 +03:00

[Companion] Fix another possible crash during model conversions (divide by zero).

This commit is contained in:
Max Paperno 2017-04-07 04:46:19 -04:00
parent 629d82fe27
commit ee50096754

View file

@ -699,6 +699,8 @@ QString RawSwitch::toString(Board::Type board, const GeneralSettings * const gen
return QObject::tr("L%1").arg(index);
case SWITCH_TYPE_MULTIPOS_POT:
if (!getCurrentFirmware()->getCapability(MultiposPotsPositions))
return QObject::tr("???");
qr = div(index - 1, getCurrentFirmware()->getCapability(MultiposPotsPositions));
if (generalSettings && qr.quot < (int)DIM(generalSettings->potConfig))
swName = QString(generalSettings->potName[qr.quot]);