Bug 528900: Null check at _[pop|push]popupsenabledstate to avoid crashing. r=jst a=dveditz
authorMartin Stransky <stransky@redhat.com>
Sat, 27 Feb 2010 09:19:04 -0500
changeset 33631 9db2d72c8b331e8e8a7ef96c9cae2814f39dfd23
parent 33630 76cf6e0523fea81e7c02a11847fc893e2f176609
child 33632 52d264a4d2f8d70f7ab5953f96f573ce8cf2c197
push id1090
push userme@kylehuey.com
push dateSat, 27 Feb 2010 14:22:01 +0000
reviewersjst, dveditz
bugs528900
milestone1.9.2.2pre
Bug 528900: Null check at _[pop|push]popupsenabledstate to avoid crashing. r=jst a=dveditz
modules/plugin/base/src/nsNPAPIPlugin.cpp
--- a/modules/plugin/base/src/nsNPAPIPlugin.cpp
+++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp
@@ -2453,31 +2453,31 @@ void* NP_CALLBACK /* OJI type: jref */
 
 void NP_CALLBACK
 _pushpopupsenabledstate(NPP npp, NPBool enabled)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_pushpopupsenabledstate called from the wrong thread\n"));
     return;
   }
-  nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)npp->ndata;
+  nsNPAPIPluginInstance *inst = npp ? (nsNPAPIPluginInstance *)npp->ndata : NULL;
   if (!inst)
     return;
 
   inst->PushPopupsEnabledState(enabled);
 }
 
 void NP_CALLBACK
 _poppopupsenabledstate(NPP npp)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_poppopupsenabledstate called from the wrong thread\n"));
     return;
   }
-  nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)npp->ndata;
+  nsNPAPIPluginInstance *inst = npp ? (nsNPAPIPluginInstance *)npp->ndata : NULL;
   if (!inst)
     return;
 
   inst->PopPopupsEnabledState();
 }
 
 class nsPluginThreadRunnable : public nsRunnable,
                                public PRCList