From a29d834bd31fcf5dedfceb159c4d36c18194197f Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 19 Oct 2020 16:09:57 +0200 Subject: [PATCH] App: [skip ci] fix PropertyEnumeration::setEnums to avoid to produce index values out of range --- src/App/PropertyStandard.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)