diff --git a/src/ifcparse/express.h b/src/ifcparse/express.h index 7c6ee795fa..c8327116b9 100644 --- a/src/ifcparse/express.h +++ b/src/ifcparse/express.h @@ -132,6 +132,11 @@ class IFC_PARSE_API base { template T as() const { + if (!*this) { + // Unresolved or malformed attribute reference (e.g. a step-id + // that never resolved to an instance). Never dereference it. + return T{}; + } if constexpr (std::is_same_v) { if (declaration().as_entity() != nullptr) { return T(data_weak());