From a1d3c63874b4fbd557b46b344ea3a330d287d0c7 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Mon, 5 Jul 2010 17:07:20 +0200
Subject: [PATCH] Fixed possible crash when computing the AST path.

---
 src/libs/cplusplus/ASTPath.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/libs/cplusplus/ASTPath.cpp b/src/libs/cplusplus/ASTPath.cpp
index d1879fa1e27..28f5437d8c2 100644
--- a/src/libs/cplusplus/ASTPath.cpp
+++ b/src/libs/cplusplus/ASTPath.cpp
@@ -44,7 +44,12 @@ QList<AST *> ASTPath::operator()(int line, int column)
     _nodes.clear();
     _line = line + 1;
     _column = column + 1;
-    accept(_doc->translationUnit()->ast());
+
+    if (_doc) {
+        if (TranslationUnit *unit = _doc->translationUnit())
+            accept(unit->ast());
+    }
+
     return _nodes;
 }
 
-- 
GitLab