Don't fail on untyped enumerations

This commit is contained in:
Thomas Krijnen
2024-11-11 13:57:36 +01:00
parent c61e3670a8
commit 088bc207ab
+3 -1
View File
@@ -60,12 +60,14 @@ namespace {
} else if (t.type == IfcParse::Token_BOOL) {
fn(IfcParse::TokenFunc::asBool(t));
} else if (t.type == IfcParse::Token_ENUMERATION) {
if (decl->as_enumeration_type()) {
if (decl && decl->as_enumeration_type()) {
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 {
Logger::Error("Untyped enumeration encountered");
}
} else if (t.type == IfcParse::Token_FLOAT) {
fn(IfcParse::TokenFunc::asFloat(t));