Catch syntax errors during iterator initialization

This commit is contained in:
aothms
2015-11-30 23:41:27 +01:00
parent bf292cccd0
commit b6e2d78bfa
+14 -10
View File
@@ -180,13 +180,15 @@ namespace IfcGeom {
// by the parent's context inverse attributes. // by the parent's context inverse attributes.
continue; continue;
} }
if (context->hasContextType()) { try {
std::string context_type = context->ContextType(); if (context->hasContextType()) {
boost::to_lower(context_type); std::string context_type = context->ContextType();
if (context_types.find(context_type) != context_types.end()) { boost::to_lower(context_type);
filtered_contexts->push(context); if (context_types.find(context_type) != context_types.end()) {
filtered_contexts->push(context);
}
} }
} } catch (const IfcParse::IfcException&) {}
} }
// In case no contexts are identified based on their ContextType, all contexts are // In case no contexts are identified based on their ContextType, all contexts are
@@ -204,10 +206,12 @@ namespace IfcGeom {
IfcSchema::IfcGeometricRepresentationContext* context = *it; IfcSchema::IfcGeometricRepresentationContext* context = *it;
representations->push(context->RepresentationsInContext()); representations->push(context->RepresentationsInContext());
if (context->hasPrecision() && context->Precision() < lowest_precision_encountered) { try {
lowest_precision_encountered = context->Precision(); if (context->hasPrecision() && context->Precision() < lowest_precision_encountered) {
any_precision_encountered = true; lowest_precision_encountered = context->Precision();
} any_precision_encountered = true;
}
} catch (const IfcParse::IfcException&) {}
IfcSchema::IfcGeometricRepresentationSubContext::list::ptr sub_contexts = context->HasSubContexts(); IfcSchema::IfcGeometricRepresentationSubContext::list::ptr sub_contexts = context->HasSubContexts();
for (jt = sub_contexts->begin(); jt != sub_contexts->end(); ++jt) { for (jt = sub_contexts->begin(); jt != sub_contexts->end(); ++jt) {
representations->push((*jt)->RepresentationsInContext()); representations->push((*jt)->RepresentationsInContext());