QmlJS: Fix possible segfaults with null documents.

This commit is contained in:
Christian Kamm
2010-08-26 11:32:04 +02:00
parent 87e04df257
commit cea32d6467

View File

@@ -1448,11 +1448,15 @@ ScopeChain &Context::scopeChain()
const ObjectValue *Context::typeEnvironment(const QmlJS::Document *doc) const
{
if (!doc)
return 0;
return _typeEnvironments.value(doc->fileName(), 0);
}
void Context::setTypeEnvironment(const QmlJS::Document *doc, const ObjectValue *typeEnvironment)
{
if (!doc)
return;
_typeEnvironments[doc->fileName()] = typeEnvironment;
}