forked from qt-creator/qt-creator
QmlJS: Fix possible segfaults with null documents.
This commit is contained in:
@@ -1448,11 +1448,15 @@ ScopeChain &Context::scopeChain()
|
|||||||
|
|
||||||
const ObjectValue *Context::typeEnvironment(const QmlJS::Document *doc) const
|
const ObjectValue *Context::typeEnvironment(const QmlJS::Document *doc) const
|
||||||
{
|
{
|
||||||
|
if (!doc)
|
||||||
|
return 0;
|
||||||
return _typeEnvironments.value(doc->fileName(), 0);
|
return _typeEnvironments.value(doc->fileName(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::setTypeEnvironment(const QmlJS::Document *doc, const ObjectValue *typeEnvironment)
|
void Context::setTypeEnvironment(const QmlJS::Document *doc, const ObjectValue *typeEnvironment)
|
||||||
{
|
{
|
||||||
|
if (!doc)
|
||||||
|
return;
|
||||||
_typeEnvironments[doc->fileName()] = typeEnvironment;
|
_typeEnvironments[doc->fileName()] = typeEnvironment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user