From 4b14c21963dd5c129446bcaa3c4511c949a27057 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 30 Jul 2026 03:34:46 +0200 Subject: [PATCH] schema nullptr dereference --- src/ifcparse/parse.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/ifcparse/parse.cpp b/src/ifcparse/parse.cpp index 9a02b7a4a4..1ee02ecc3f 100644 --- a/src/ifcparse/parse.cpp +++ b/src/ifcparse/parse.cpp @@ -1944,17 +1944,19 @@ void ifcopenshell::instance_streamer::initialize_header() { storage_.schema = schema_; - types_to_bypass_materialized_.resize(schema_->declarations().size(), false); - for (auto& bp : types_to_bypass_) { - std::function mark; - mark = [&](const ifcopenshell::entity* e) { - types_to_bypass_materialized_[e->index_in_schema()] = true; - for (auto& subtype : e->subtypes()) { - mark(subtype); + if (schema_) { + types_to_bypass_materialized_.resize(schema_->declarations().size(), false); + for (auto& bp : types_to_bypass_) { + std::function mark; + mark = [&](const ifcopenshell::entity* e) { + types_to_bypass_materialized_[e->index_in_schema()] = true; + for (auto& subtype : e->subtypes()) { + mark(subtype); + } + }; + if (auto* e = bp->as_entity()) { + mark(e); } - }; - if (auto* e = bp->as_entity()) { - mark(e); } } }