QmlJSEditor: Fix nullptr access

Avoids a crash when triggering 'Find Usage' on a Qml Item.

Change-Id: I3980e6a7aae891f853148017341a2f29a07e03ad
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Stenger
2019-02-13 15:38:58 +01:00
parent 667eb57169
commit 75d9b56c1a

View File

@@ -322,11 +322,13 @@ protected:
bool visit(AST::UiPublicMember *node) override
{
if (node->memberType->name == _name){
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<Block *>(node->statement)) {
_builder.push(node);
Node::accept(node->statement, this);