diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp index c2b692a71885..192322553c9e 100644 --- a/dom/script/ScriptLoader.cpp +++ b/dom/script/ScriptLoader.cpp @@ -1781,6 +1781,10 @@ ScriptLoader::FireScriptEvaluated(nsresult aResult, already_AddRefed ScriptLoader::GetScriptGlobalObject() { + if (!mDocument) { + return nullptr; + } + nsPIDOMWindowInner* pwin = mDocument->GetInnerWindow(); if (!pwin) { return nullptr;