Fix crash related to 'add definition from declaration' quickfix.

Reviewed-by: hjk
Reviewed-by: Erik Verbruggen
This commit is contained in:
Christian Kamm
2010-10-07 14:47:25 +02:00
parent 95107b0998
commit f0f623bcb8
2 changed files with 10 additions and 7 deletions

View File

@@ -287,8 +287,10 @@ QList<CppQuickFixOperation::Ptr> DefFromDecl::match(const CppQuickFixState &stat
CppRefactoringChanges refactoring(state.snapshot());
InsertionPointLocator locator(&refactoring);
QList<CppQuickFixOperation::Ptr> results;
foreach (const InsertionLocation &loc, locator.methodDefinition(decl))
results.append(CppQuickFixOperation::Ptr(new InsertDefOperation(state, idx, decl, loc)));
foreach (const InsertionLocation &loc, locator.methodDefinition(decl)) {
if (loc.isValid())
results.append(CppQuickFixOperation::Ptr(new InsertDefOperation(state, idx, decl, loc)));
}
return results;
}
}