From 6f2e1aa993c0a34f9aa539d0466680718ea5f0e2 Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Sat, 29 Aug 2026 12:58:58 +0300 Subject: [PATCH] fix(#6032): guard express::base::as() on null instance --- src/ifcparse/express.h | 5 +++++ 1 file changed, 5 insertions(+) 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());