Commit 26a9f01d authored by Nikolai Kosjar's avatar Nikolai Kosjar

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: default avatarNikita Baryshnikov <nib952051@gmail.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 26f98097
......@@ -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);
......
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