From 75d9b56c1a6739c39a0cd12cba1db7d4bd479778 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 13 Feb 2019 15:38:58 +0100 Subject: [PATCH] QmlJSEditor: Fix nullptr access Avoids a crash when triggering 'Find Usage' on a Qml Item. Change-Id: I3980e6a7aae891f853148017341a2f29a07e03ad Reviewed-by: Eike Ziller --- src/plugins/qmljseditor/qmljsfindreferences.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index 67abdece261..8b790c33510 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -322,10 +322,12 @@ protected: bool visit(AST::UiPublicMember *node) override { - if (node->memberType->name == _name){ - const ObjectValue * tVal = _context->lookupType(_doc.data(), QStringList(_name)); - if (tVal == _typeValue) - _usages.append(node->typeToken); + if (UiQualifiedId *memberType = node->memberType) { + if (memberType->name == _name) { + const ObjectValue * tVal = _context->lookupType(_doc.data(), QStringList(_name)); + if (tVal == _typeValue) + _usages.append(node->typeToken); + } } if (AST::cast(node->statement)) { _builder.push(node);