Commit 72e30386 authored by David Schulz's avatar David Schulz Committed by Jarek Kobus
Browse files

Editor: Fix NULL-Pointer dereference in cppfunctiondecldeflink



Happen when trying to synchronize a return type in an inapropriate AST.

Task-number:QTCREATORBUG-7073
Change-Id: I6621a3d5539f96c0db9e0d20423dba9a7def98fc
Reviewed-by: default avatarChristian Kamm <christian.d.kamm@nokia.com>
parent bb63ec80
......@@ -613,7 +613,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
LookupContext targetContext(targetFile->cppDocument(), snapshot);
// sync return type
{
do {
// set up for rewriting return type
SubstitutionEnvironment env;
env.setContext(sourceContext);
......@@ -637,6 +637,9 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
declarator = def->declarator;
firstReplaceableSpecifier = findFirstReplaceableSpecifier(
targetTranslationUnit, def->decl_specifier_list);
} else {
// no proper AST to synchronize the return type
break;
}
int returnTypeStart = 0;
......@@ -653,7 +656,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
targetFile->startOf(targetFunctionDeclarator->lparen_token),
replacement);
}
}
} while (false);
// sync parameters
{
......
Supports Markdown
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