forked from qt-creator/qt-creator
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: Christian Kamm <christian.d.kamm@nokia.com>
This commit is contained in:
committed by
Jarek Kobus
parent
bb63ec80eb
commit
72e3038629
@@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user