Bug 528900: Null check at _[pop|push]popupsenabledstate to avoid crashing r=jst
authorMartin Stransky <stransky@redhat.com>
Sat, 20 Feb 2010 08:53:10 -0500
changeset 38327 00cef42f43bfd0d1bf24190c8da0070d35138dfb
parent 38326 231571aa811b567d2fd989210f73ccf7e843330a
child 38328 96d301b39c9157297b8704f6e9db81b7a7ff05a4
push idunknown
push userunknown
push dateunknown
reviewersjst
bugs528900
milestone1.9.3a2pre
Bug 528900: Null check at _[pop|push]popupsenabledstate to avoid crashing r=jst
modules/plugin/base/src/nsNPAPIPlugin.cpp
--- a/modules/plugin/base/src/nsNPAPIPlugin.cpp
+++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp
@@ -2434,31 +2434,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();
 }
 
 void NP_CALLBACK
 _pluginthreadasynccall(NPP instance, PluginThreadCallback func, void *userData)