forked from qt-creator/qt-creator
Check if the document ptr is not null
Avoid a crash when double click in hierarchy view after the session has been changed or when the filename changed. Change-Id: Iebd7a99c220737262c79ade43c4ee8d11dcc037f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -548,6 +548,9 @@ public:
|
|||||||
QString &expression)
|
QString &expression)
|
||||||
{
|
{
|
||||||
doc = snapshot.document(m_fileName);
|
doc = snapshot.document(m_fileName);
|
||||||
|
if (doc.isNull())
|
||||||
|
return false;
|
||||||
|
|
||||||
expression = m_expression;
|
expression = m_expression;
|
||||||
|
|
||||||
// Fetch the expression's code
|
// Fetch the expression's code
|
||||||
@@ -729,6 +732,8 @@ Utils::Link CppElementEvaluator::linkFromExpression(const QString &expression, c
|
|||||||
{
|
{
|
||||||
const Snapshot &snapshot = CppModelManager::instance()->snapshot();
|
const Snapshot &snapshot = CppModelManager::instance()->snapshot();
|
||||||
Document::Ptr doc = snapshot.document(fileName);
|
Document::Ptr doc = snapshot.document(fileName);
|
||||||
|
if (doc.isNull())
|
||||||
|
return Utils::Link();
|
||||||
Scope *scope = doc->globalNamespace();
|
Scope *scope = doc->globalNamespace();
|
||||||
|
|
||||||
TypeOfExpression typeOfExpression;
|
TypeOfExpression typeOfExpression;
|
||||||
|
Reference in New Issue
Block a user