diff --git a/src/App/PropertyStandard.cpp b/src/App/PropertyStandard.cpp index 8692fbb4cb..5c30d7250c 100644 --- a/src/App/PropertyStandard.cpp +++ b/src/App/PropertyStandard.cpp @@ -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(index, max); } void PropertyEnumeration::setValue(const char *value)