Skip to content

Commit

Permalink
+ fix Enumeration::contains: the current index is irrelevant when sea…
Browse files Browse the repository at this point in the history
…rching for an entry in the enumeration

+ only print a warning if the enumeration is not empty but the restored index is < 0
  • Loading branch information
wwmayer committed May 19, 2020
1 parent a724961 commit 8fcd436
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/App/Enumeration.cpp
Expand Up @@ -220,7 +220,7 @@ bool Enumeration::contains(const char *value) const
// using string methods without set, use setEnums(const char** plEnums) first!
//assert(_EnumArray);

if (!isValid()) {
if (!getEnums()) {
return false;
}

Expand Down
4 changes: 3 additions & 1 deletion src/App/PropertyStandard.cpp
Expand Up @@ -432,7 +432,9 @@ void PropertyEnumeration::Restore(Base::XMLReader &reader)
}

if (val < 0) {
Base::Console().Warning("Enumeration index %d is out of range, ignore it\n", val);
// If the enum is empty at this stage do not print a warning
if (_enum.getEnums())
Base::Console().Warning("Enumeration index %d is out of range, ignore it\n", val);
val = getValue();
}

Expand Down

0 comments on commit 8fcd436

Please sign in to comment.