From 12318fbfc2a52785dd16ee65c0297fbd019af470 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 5 Sep 2024 14:38:21 +0200 Subject: [PATCH] Handle storage of nullptr as a proper Blank type in variant #5308 --- src/ifcparse/IfcParse.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index 298295e6a2..0ea64c2f78 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -1149,7 +1149,15 @@ void IfcUtil::IfcBaseClass::set_attribute_value(size_t i, const T& t) { apply_individual_instance_visitor(current_attribute, (int) i).apply(visitor); } - data_.storage_.set(i, t); + if constexpr (std::is_pointer_v) { + if (t) { + data_.storage_.set(i, t); + } else { + data_.storage_.set(i, Blank{}); + } + } else { + data_.storage_.set(i, t); + } auto new_attribute = data_.get_attribute_value(i); if (file_ != nullptr) {