App: [skip ci] fix PropertyEnumeration::setEnums to avoid to produce index values out of range

This commit is contained in:
wmayer
2020-10-19 16:09:57 +02:00
parent db093ed0e0
commit d60f75b3b0

View File

@@ -324,7 +324,9 @@ void PropertyEnumeration::setEnums(const char **plEnums)
// to be preserved.
int index = _enum._index;
_enum.setEnums(plEnums);
_enum._index = index;
// Make sure not to set an index out of range
int max = _enum.maxValue();
_enum._index = std::min<int>(index, max);
}
void PropertyEnumeration::setValue(const char *value)