From bb41c375b0add6858f5f3c6e35c11d957351dcff Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <erik.verbruggen@nokia.com>
Date: Tue, 6 Sep 2011 10:44:23 +0200
Subject: [PATCH] C++: removed assert that could crash creator. Gracefully exit
 instead.

Change-Id: Iab79b2548195feb83b3f408f0eb612878454bd47
Reviewed-on: http://codereview.qt.nokia.com/4246
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
---
 src/libs/cplusplus/ASTPath.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libs/cplusplus/ASTPath.cpp b/src/libs/cplusplus/ASTPath.cpp
index 15c836776e4..64071b39307 100644
--- a/src/libs/cplusplus/ASTPath.cpp
+++ b/src/libs/cplusplus/ASTPath.cpp
@@ -71,7 +71,8 @@ bool ASTPath::preVisit(AST *ast)
     unsigned lastToken = ast->lastToken();
 
     if (firstToken > 0) {
-        Q_ASSERT(lastToken > firstToken);
+        if (lastToken <= firstToken)
+            return false;
 
         unsigned startLine, startColumn;
         getTokenStartPosition(firstToken, &startLine, &startColumn);
-- 
GitLab