forked from qt-creator/qt-creator
CppEditor: Check for a valid document
...from the semantic info before trying to use it. Just after opening a file and using Follow Symbol the semantic document might not be yet calculated. Change-Id: I62deaf86415a2e2b0d7f1285f90bdcd9b5925a2e Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -310,9 +310,10 @@ CPPEditorWidget::Link attemptFuncDeclDef(const QTextCursor &cursor,
|
||||
CPPEditorWidget *, CPlusPlus::Snapshot snapshot, const CPlusPlus::Document::Ptr &document,
|
||||
SymbolFinder *symbolFinder)
|
||||
{
|
||||
snapshot.insert(document);
|
||||
|
||||
Link result;
|
||||
QTC_ASSERT(document, return result);
|
||||
|
||||
snapshot.insert(document);
|
||||
|
||||
QList<AST *> path = ASTPath(document)(cursor);
|
||||
|
||||
@@ -518,7 +519,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
||||
}
|
||||
|
||||
// Check if we're on an operator declaration or definition.
|
||||
if (!recognizedQtMethod) {
|
||||
if (!recognizedQtMethod && documentFromSemanticInfo) {
|
||||
bool cursorRegionReached = false;
|
||||
for (int i = 0; i < tokens.size(); ++i) {
|
||||
const Token &tk = tokens.at(i);
|
||||
|
||||
Reference in New Issue
Block a user