CppEditor: Fix access to dangling pointer

Found by coverity.

Change-Id: I4b73af9b22b80953b4ba6c1004884862c9bdd3b8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2020-06-03 14:14:15 +02:00
parent f899c49dca
commit 9e08ecb816

View File

@@ -1983,7 +1983,7 @@ LookupResult lookUpDefinition(const CppQuickFixInterface &interface, const NameA
// Find the enclosing scope
int line, column;
const Document::Ptr &doc = interface.semanticInfo().doc;
const Document::Ptr doc = interface.semanticInfo().doc;
doc->translationUnit()->getTokenStartPosition(nameAst->firstToken(), &line, &column);
Scope *scope = doc->scopeAt(line, column);
if (!scope)