fix(#6032): guard express::base::as<T>() on null instance

This commit is contained in:
Petru Conduraru
2026-08-29 12:58:58 +03:00
committed by Thomas Krijnen
parent c80569ecc7
commit 6f2e1aa993
+5
View File
@@ -132,6 +132,11 @@ class IFC_PARSE_API base {
template <class T> template <class T>
T as() const { 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<entity, T>) { if constexpr (std::is_same_v<entity, T>) {
if (declaration().as_entity() != nullptr) { if (declaration().as_entity() != nullptr) {
return T(data_weak()); return T(data_weak());