From 8269be2ab9515fda83c6e246ab55d88c417462d3 Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Tue, 15 Dec 2009 10:07:52 +0100 Subject: [PATCH] Quickfix: Don't crash on ifstmts with a null statement member. --- src/plugins/cppeditor/cppquickfix.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/cppeditor/cppquickfix.cpp b/src/plugins/cppeditor/cppquickfix.cpp index da672931f0e..5838fbbafef 100644 --- a/src/plugins/cppeditor/cppquickfix.cpp +++ b/src/plugins/cppeditor/cppquickfix.cpp @@ -463,7 +463,8 @@ public: // ### This may not be such a good idea, consider nested ifs... for (; index != -1; --index) { IfStatementAST *ifStatement = path.at(index)->asIfStatement(); - if (ifStatement && isCursorOn(ifStatement->statement) + if (ifStatement && ifStatement->statement + && isCursorOn(ifStatement->statement) && ! ifStatement->statement->asCompoundStatement()) { _statement = ifStatement->statement; return index; @@ -668,7 +669,7 @@ public: } } - if (! pattern) + if (! pattern || ! pattern->statement) return -1; unsigned splitKind = 0; -- GitLab