From e1edda588eb325b789d6b2144f16ed25c387e642 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 22 Jan 2015 10:38:35 +0000 Subject: [PATCH] Properly test for the optional IfcGeometricRepresentationContext.ContextType being null in IfcGeomIterator.h --- src/ifcgeom/IfcGeomIterator.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ifcgeom/IfcGeomIterator.h b/src/ifcgeom/IfcGeomIterator.h index 3908b16eed..1cb5b6b7d0 100644 --- a/src/ifcgeom/IfcGeomIterator.h +++ b/src/ifcgeom/IfcGeomIterator.h @@ -153,12 +153,14 @@ namespace IfcGeom { // by the parent's context inverse attributes. continue; } - std::string context_type_lc = context->ContextType(); - for (std::string::iterator c = context_type_lc.begin(); c != context_type_lc.end(); ++c) { - *c = tolower(*c); - } - if (context->hasContextType() && context_types.find(context_type_lc) != context_types.end()) { - filtered_contexts->push(context); + if (context->hasContextType()) { + std::string context_type_lc = context->ContextType(); + for (std::string::iterator c = context_type_lc.begin(); c != context_type_lc.end(); ++c) { + *c = tolower(*c); + } + if (context_types.find(context_type_lc) != context_types.end()) { + filtered_contexts->push(context); + } } }