From 284154d053904b799cea554c03509858d9e40a70 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Mon, 28 Nov 2022 09:47:19 +0800 Subject: [PATCH] ENH: start normally when deal with unknown enumeration value Change-Id: Ibc3d47a6181528e3aa747d79ae2a436f548f05f1 (cherry picked from commit 7fc01b6f1aea831b41d5a63b3d8858de12572b65) --- src/libslic3r/Config.cpp | 2 +- src/libslic3r/Config.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 889641536..a20fdf80c 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -615,7 +615,7 @@ bool ConfigBase::set_deserialize_raw(const t_config_option_key &opt_key_src, con if (! success && substitutions_ctxt.rule != ForwardCompatibilitySubstitutionRule::Disable && // Only allow substitutions of an enum value by another enum value or a boolean value with an enum value. // That means, we expect enum values being added in the future and possibly booleans being converted to enums. - (optdef->type == coEnum || optdef->type == coBool) && ConfigHelpers::looks_like_enum_value(value)) { + (optdef->type == coEnum || optdef->type == coEnums || optdef->type == coBool) /*&& ConfigHelpers::looks_like_enum_value(value)*/) { // Deserialize failed, try to substitute with a default value. //assert(substitutions_ctxt.rule == ForwardCompatibilitySubstitutionRule::Enable || substitutions_ctxt.rule == ForwardCompatibilitySubstitutionRule::EnableSilent); if (optdef->type == coBool) diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 42fa9df62..3c7f13092 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1701,12 +1701,12 @@ public: while (std::getline(is, item_str, ',')) { boost::trim(item_str); if (item_str == "nil") { - throw ConfigurationError("Deserializing nil into a non-nullable object"); + return false; } else { auto it = this->keys_map->find(item_str); if (it == this->keys_map->end()) - throw ConfigurationError(std::string("Unknown enum type: ") + item_str); + return false; this->values.push_back(it->second); } }