From e7daf871b810d049509682f5440d64ecdd89bfc8 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sun, 4 Nov 2018 15:16:08 +0100 Subject: [PATCH] Disallow adding instances from different schema --- src/ifcparse/IfcParse.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index 0e9f40ad07..fbc0d35e51 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -1511,6 +1511,10 @@ void IfcFile::addEntities(IfcEntityList::ptr es) { } IfcUtil::IfcBaseClass* IfcFile::addEntity(IfcUtil::IfcBaseClass* entity) { + if (entity->declaration().schema() != schema()) { + throw IfcParse::IfcException("Unabled to add instance from " + entity->declaration().schema()->name() + " schema to file with " + schema()->name() + " schema"); + } + // If this instance has been inserted before, return // a reference to the copy that was created from it. entity_entity_map_t::iterator mit = entity_file_map.find(entity);