Quickfix: Don't crash on ifstmts with a null statement member.

This commit is contained in:
Christian Kamm
2009-12-15 10:07:52 +01:00
parent d282ee9bdf
commit 8269be2ab9

View File

@@ -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;