From af98aa02ae72f28f1c1c718f35b4d3f317c3080b Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Thu, 30 May 2013 11:26:12 -0400 Subject: [PATCH] Bug 877638 - Crash in WakeLockBoolWrapper::UpdateWakeLock when running crashtests. r=ehsan --- content/html/content/src/HTMLMediaElement.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/html/content/src/HTMLMediaElement.cpp b/content/html/content/src/HTMLMediaElement.cpp index 8c41ab4036d1..0bf2913767d9 100644 --- a/content/html/content/src/HTMLMediaElement.cpp +++ b/content/html/content/src/HTMLMediaElement.cpp @@ -2153,8 +2153,10 @@ HTMLMediaElement::WakeLockBoolWrapper::UpdateWakeLock() // grace period. int timeout = Preferences::GetInt("media.wakelock_timeout", 2000); mTimer = do_CreateInstance("@mozilla.org/timer;1"); - mTimer->InitWithFuncCallback(TimerCallback, this, timeout, - nsITimer::TYPE_ONE_SHOT); + if (mTimer) { + mTimer->InitWithFuncCallback(TimerCallback, this, timeout, + nsITimer::TYPE_ONE_SHOT); + } } }