forked from qt-creator/qt-creator
QmlJS: Fix potential crash in find usages.
When invalid documents or documents without idEnvironment or rootScope get added to a QmlComponentChain. Change-Id: I64b7062881f19777ba20efda6efa2e7bab02571e Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -246,13 +246,14 @@ protected:
|
||||
private:
|
||||
bool contains(const QmlComponentChain *chain)
|
||||
{
|
||||
if (!chain || !chain->document())
|
||||
if (!chain || !chain->document() || !chain->document()->bind())
|
||||
return false;
|
||||
|
||||
if (chain->document()->bind()->idEnvironment()->lookupMember(_name, _scopeChain.context()))
|
||||
return chain->document()->bind()->idEnvironment() == _scope;
|
||||
const ObjectValue *idEnv = chain->document()->bind()->idEnvironment();
|
||||
if (idEnv && idEnv->lookupMember(_name, _scopeChain.context()))
|
||||
return idEnv == _scope;
|
||||
const ObjectValue *root = chain->document()->bind()->rootObjectValue();
|
||||
if (root->lookupMember(_name, _scopeChain.context())) {
|
||||
if (root && root->lookupMember(_name, _scopeChain.context())) {
|
||||
return check(root);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user