From 9c38a7c58bc62374a6e5be5a7495bbb6230106b2 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Fri, 23 Aug 2024 11:25:14 +0200 Subject: [PATCH] Don't fail on invalid enumeration literal --- src/ifcparse/IfcFile.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ifcparse/IfcFile.cpp b/src/ifcparse/IfcFile.cpp index f7b256586d..47232b95cb 100644 --- a/src/ifcparse/IfcFile.cpp +++ b/src/ifcparse/IfcFile.cpp @@ -53,7 +53,11 @@ namespace { fn(IfcParse::TokenFunc::asBool(t)); } else if (t.type == IfcParse::Token_ENUMERATION) { if (decl->as_enumeration_type()) { - fn(EnumerationReference(decl->as_enumeration_type(), decl->as_enumeration_type()->lookup_enum_offset(IfcParse::TokenFunc::asStringRef(t)))); + try { + fn(EnumerationReference(decl->as_enumeration_type(), decl->as_enumeration_type()->lookup_enum_offset(IfcParse::TokenFunc::asStringRef(t)))); + } catch (IfcParse::IfcException& e) { + Logger::Error(e); + } } } else if (t.type == IfcParse::Token_FLOAT) { fn(IfcParse::TokenFunc::asFloat(t));