From d7caea2cbaeddfc1db78a665bc034bbb1183dc2a Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 8 Nov 2017 12:12:46 +0100 Subject: [PATCH] fix crashes in dependency walker --- src/App/Document.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 3435ff49af..50991a1fb9 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -279,6 +279,8 @@ void Document::exportGraphviz(std::ostream& out) const std::string getId(const ObjectIdentifier & path) { DocumentObject * docObj = path.getDocumentObject(); + if (!docObj) + return std::string(); return std::string((docObj)->getDocument()->getName()) + "#" + docObj->getNameInDocument() + "." + path.getPropertyName() + path.getSubPathStr(); } @@ -336,7 +338,7 @@ void Document::exportGraphviz(std::ostream& out) const boost::unordered_map expressions = obj->ExpressionEngine.getExpressions(); - if (expressions.size() > 0) { + if (!expressions.empty()) { Graph* graph = nullptr; graph = &DepList; @@ -350,7 +352,7 @@ void Document::exportGraphviz(std::ostream& out) const } // If documentObject has an expression, create a subgraph for it - if (!GraphList[obj] && graph) { + if (graph && !GraphList[obj]) { GraphList[obj] = &graph->create_subgraph(); setGraphAttributes(obj); } @@ -367,8 +369,8 @@ void Document::exportGraphviz(std::ostream& out) const DocumentObject * o = j->getDocumentObject(); // Doesn't exist already? - if (!GraphList[o]) { - + if (o && !GraphList[o]) { + if (CSsubgraphs) { auto group = GeoFeatureGroupExtension::getGroupOfObject(o); auto graph2 = group ? GraphList[group] : &DepList;