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,10 +322,12 @@ protected:
bool visit(AST::UiPublicMember *node) override bool visit(AST::UiPublicMember *node) override
{ {
if (node->memberType->name == _name){ if (UiQualifiedId *memberType = node->memberType) {
const ObjectValue * tVal = _context->lookupType(_doc.data(), QStringList(_name)); if (memberType->name == _name) {
if (tVal == _typeValue) const ObjectValue * tVal = _context->lookupType(_doc.data(), QStringList(_name));
_usages.append(node->typeToken); if (tVal == _typeValue)
_usages.append(node->typeToken);
}
} }
if (AST::cast<Block *>(node->statement)) { if (AST::cast<Block *>(node->statement)) {
_builder.push(node); _builder.push(node);