Skip to content

Commit

Permalink
App: [skip ci] fix PropertyEnumeration::setEnums to avoid to produce …
Browse files Browse the repository at this point in the history
…index values out of range
  • Loading branch information
wwmayer committed Oct 19, 2020
1 parent 6e6f2c8 commit a29d834
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/App/PropertyStandard.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit a29d834

Please sign in to comment.