Bug 827254 - Guard against garbage plugin instance in ANPSystem::setPowerState r=blassey

This commit is contained in:
James Willcox 2013-03-04 09:06:42 -05:00
parent 546582e56f
commit fac471fc87

View File

@ -66,9 +66,11 @@ jclass anp_system_loadJavaClass(NPP instance, const char* className)
void anp_system_setPowerState(NPP instance, ANPPowerState powerState) void anp_system_setPowerState(NPP instance, ANPPowerState powerState)
{ {
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata); nsNPAPIPluginInstance* pinst = nsNPAPIPluginInstance::GetFromNPP(instance);
pinst->SetWakeLock(powerState == kScreenOn_ANPPowerState); if (pinst) {
pinst->SetWakeLock(powerState == kScreenOn_ANPPowerState);
}
} }
void InitSystemInterface(ANPSystemInterfaceV0 *i) { void InitSystemInterface(ANPSystemInterfaceV0 *i) {