Bug 620297 crash [@ nsPluginHost::SetUpPluginInstance] if !aOwner, r+a=josh
authortimeless@mozdev.org
Mon, 20 Dec 2010 01:13:00 -0800
changeset 59670 5156cf7f241144a2ca5ca63b5dfcae991491f39d
parent 59669 c84a2abbc66327b83335ee5d75af89af51868eca
child 59671 840641b4d46503e15336b7d6086a224229c78317
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
bugs620297
milestone2.0b9pre
Bug 620297 crash [@ nsPluginHost::SetUpPluginInstance] if !aOwner, r+a=josh
modules/plugin/base/src/nsPluginHost.cpp
--- a/modules/plugin/base/src/nsPluginHost.cpp
+++ b/modules/plugin/base/src/nsPluginHost.cpp
@@ -1248,30 +1248,31 @@ nsresult nsPluginHost::FindStoppedPlugin
   }
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsPluginHost::SetUpPluginInstance(const char *aMimeType,
                                                 nsIURI *aURL,
                                                 nsIPluginInstanceOwner *aOwner)
 {
+  NS_ENSURE_ARG_POINTER(aOwner);
+
   nsresult rv = NS_OK;
 
   rv = TrySetUpPluginInstance(aMimeType, aURL, aOwner);
 
   // if we fail, refresh plugin list just in case the plugin has been
   // just added and try to instantiate plugin instance again, see bug 143178
   if (NS_FAILED(rv)) {
     // we should also make sure not to do this more than once per page
     // so if there are a few embed tags with unknown plugins,
     // we don't get unnecessary overhead
     // let's cache document to decide whether this is the same page or not
     nsCOMPtr<nsIDocument> document;
-    if (aOwner)
-      aOwner->GetDocument(getter_AddRefs(document));
+    aOwner->GetDocument(getter_AddRefs(document));
 
     nsCOMPtr<nsIDocument> currentdocument = do_QueryReferent(mCurrentDocument);
     if (document == currentdocument)
       return rv;
 
     mCurrentDocument = do_GetWeakReference(document);
 
     // ReloadPlugins will do the job smartly: nothing will be done