From d2e7f8e4e66c17d0e534b6662e5ebab9ed9f55b8 Mon Sep 17 00:00:00 2001
From: Christian Kamm <christian.d.kamm@nokia.com>
Date: Wed, 25 Nov 2009 09:59:59 +0100
Subject: [PATCH] Quickfix: Don't crash when the AST path is empty.

---
 src/plugins/cppeditor/cppquickfix.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/plugins/cppeditor/cppquickfix.cpp b/src/plugins/cppeditor/cppquickfix.cpp
index b09468d23e7..4974e25591f 100644
--- a/src/plugins/cppeditor/cppquickfix.cpp
+++ b/src/plugins/cppeditor/cppquickfix.cpp
@@ -275,6 +275,9 @@ public:
 
     virtual int match(const QList<AST *> &path)
     {
+        if (path.size() == 0)
+            return -1;        
+
         // show when we're on the 'if' of an if statement
         int index = path.size() - 1;
         IfStatementAST *ifStatement = path.at(index)->asIfStatement();
-- 
GitLab