diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index b943af05ed..aa655c1945 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -2110,7 +2110,11 @@ void IfcFile::process_deletion_() { } } { - byref_excl.erase(name); + auto byref_it = byref_excl.find(name); + if (byref_it != byref_excl.end()) { + auto& ids = byref_it->second; + ids.erase(std::remove(ids.begin(), ids.end(), id), ids.end()); + } } } }