qmljs/qmljshoverhandler: fix possible deref of null

Change-Id: I7fc02b4f36fd34a94344bc0956b0daf731e73d17
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Fawzi Mohamed
2013-02-19 13:34:47 +01:00
parent 75e608ec2e
commit 3e9ed79845

View File

@@ -461,10 +461,11 @@ bool HoverHandler::setQmlHelpItem(const ScopeChain &scopeChain,
if (const ObjectValue *scope = isMember(scopeChain, node, &name)) {
// maybe it's a type?
if (!name.isEmpty() && name.at(0).isUpper()) {
AST::UiQualifiedId *qualifiedId = AST::cast<AST::UiQualifiedId *>(node);
const ObjectValue *value = scopeChain.context()->lookupType(qmlDocument.data(), qualifiedId);
if (setQmlTypeHelp(scopeChain, qmlDocument, value, QStringList(qualifiedId->name.toString())))
return true;
if (AST::UiQualifiedId *qualifiedId = AST::cast<AST::UiQualifiedId *>(node)) {
const ObjectValue *value = scopeChain.context()->lookupType(qmlDocument.data(), qualifiedId);
if (setQmlTypeHelp(scopeChain, qmlDocument, value, QStringList(qualifiedId->name.toString())))
return true;
}
}
// otherwise, it's probably a property