Editor: Fix NULL-Pointer dereference in cppinsertdecldef

Task-number: QTCREATORBUG-7030

Change-Id: Id2467f24dff289b6d23407ea15b181f76c8fd2e7
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
David Schulz
2012-03-05 13:00:10 +01:00
committed by Leandro Melo
parent deeb8fe351
commit 62fd2713d0

View File

@@ -533,6 +533,7 @@ QPair<QString, QString> assembleDeclarationData(const QString &specifiers,
const CppRefactoringFilePtr &file,
const Overview &printer)
{
QTC_ASSERT(decltr, return (QPair<QString, QString>()));
if (decltr->core_declarator
&& decltr->core_declarator->asDeclaratorId()
&& decltr->core_declarator->asDeclaratorId()->name) {
@@ -788,6 +789,7 @@ QList<CppQuickFixOperation::Ptr> ExtractFunction::match(
it;
it = it->next) {
ParameterDeclarationAST *paramDecl = it->value->asParameterDeclaration();
if (paramDecl->declarator) {
const QString &specifiers =
file->textOf(file->startOf(paramDecl),
file->endOf(paramDecl->type_specifier_list->lastValue()));
@@ -800,6 +802,7 @@ QList<CppQuickFixOperation::Ptr> ExtractFunction::match(
}
}
}
}
// Identify what would be parameters for the new function and its return value, if any.
Symbol *funcReturn = 0;