Bug 528900: Null check at _[pop|push]popupsenabledstate to avoid crashing. r=jst a=dveditz
--- 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