diff --git a/js/xpconnect/loader/mozJSSubScriptLoader.cpp b/js/xpconnect/loader/mozJSSubScriptLoader.cpp index 156b910d029..9acb29828a0 100644 --- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -182,8 +182,10 @@ mozJSSubScriptLoader::LoadSubScript(const nsAString& url, if (!targetObj) { // If the user didn't provide an object to eval onto, find one. mozJSComponentLoader* loader = mozJSComponentLoader::Get(); - rv = loader->FindTargetObject(cx, &targetObj); - NS_ENSURE_SUCCESS(rv, rv); + if (loader) { + rv = loader->FindTargetObject(cx, &targetObj); + NS_ENSURE_SUCCESS(rv, rv); + } } // Remember an object out of the calling compartment so that we