From 6c020f554d039658e0c81bf37d866062e5281ff2 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 19 May 2020 08:45:02 +0200 Subject: [PATCH] + fix Enumeration::contains: the current index is irrelevant when searching for an entry in the enumeration + only print a warning if the enumeration is not empty but the restored index is < 0 --- src/App/Enumeration.cpp | 2 +- src/App/PropertyStandard.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/App/Enumeration.cpp b/src/App/Enumeration.cpp index 23704b0a17..f9a346c55c 100644 --- a/src/App/Enumeration.cpp +++ b/src/App/Enumeration.cpp @@ -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; } diff --git a/src/App/PropertyStandard.cpp b/src/App/PropertyStandard.cpp index 36ae665353..a3a0a8eb4f 100644 --- a/src/App/PropertyStandard.cpp +++ b/src/App/PropertyStandard.cpp @@ -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(); }