diff --git a/src/plugins/cppeditor/cppquickfix.cpp b/src/plugins/cppeditor/cppquickfix.cpp index da672931f0e41e4446099650582c77c11e7c52a5..5838fbbafef7a28be11b7614e25eafe42e9255fd 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;