Commit 62fd2713 authored by David Schulz's avatar David Schulz Committed by Leandro Melo
Browse files

Editor: Fix NULL-Pointer dereference in cppinsertdecldef



Task-number: QTCREATORBUG-7030

Change-Id: Id2467f24dff289b6d23407ea15b181f76c8fd2e7
Reviewed-by: default avatarLeandro Melo <leandro.melo@nokia.com>
parent deeb8fe3
......@@ -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,14 +789,16 @@ QList<CppQuickFixOperation::Ptr> ExtractFunction::match(
it;
it = it->next) {
ParameterDeclarationAST *paramDecl = it->value->asParameterDeclaration();
const QString &specifiers =
file->textOf(file->startOf(paramDecl),
file->endOf(paramDecl->type_specifier_list->lastValue()));
const QPair<QString, QString> &p =
assembleDeclarationData(specifiers, paramDecl->declarator, file, printer);
if (!p.first.isEmpty()) {
analyser.m_knownDecls.insert(p.first, p.second);
refFuncParams.insert(p.first);
if (paramDecl->declarator) {
const QString &specifiers =
file->textOf(file->startOf(paramDecl),
file->endOf(paramDecl->type_specifier_list->lastValue()));
const QPair<QString, QString> &p =
assembleDeclarationData(specifiers, paramDecl->declarator, file, printer);
if (!p.first.isEmpty()) {
analyser.m_knownDecls.insert(p.first, p.second);
refFuncParams.insert(p.first);
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment