From 6d5c0c0d78982fc7d6207c363e13098557994416 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 25 Aug 2011 14:55:52 +0200 Subject: [PATCH] C++ function link: The symbol can be unavailable on parser error. Change-Id: I7a95adcaafff5ff845ae0fdef5bea8c3846a6ffe Reviewed-on: http://codereview.qt.nokia.com/3599 Reviewed-by: Friedemann Kleint --- src/plugins/cppeditor/cppfunctiondecldeflink.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index 545ae54af4c..fc415e377c7 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -371,15 +371,14 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ newDeclDoc->check(); // extract the function symbol - if (!newDeclDoc->translationUnit()->ast()) { + if (!newDeclDoc->translationUnit()->ast()) return changes; - } FunctionDefinitionAST *newDef = newDeclDoc->translationUnit()->ast()->asFunctionDefinition(); - if (!newDef) { + if (!newDef) return changes; - } Function *newFunction = newDef->symbol; - QTC_ASSERT(newFunction, return changes); // check() should always create this symbol + if (!newFunction) + return changes; const LookupContext &sourceContext = typeOfExpression.context(); LookupContext targetContext(targetFile->cppDocument(), snapshot);