Bug 1300016 - only suspend web-speech when mUtterance exists. draft
authorAlastor Wu <alwu@mozilla.com>
Mon, 07 Nov 2016 17:49:13 +0800
changeset 434757 13bf8028b9b783af472088b845ad9b1447f02dce
parent 434751 adab73e02584fab12a9688cb12716082e1976bca
child 536111 fe9c239d63b9a6a9cf106e7d3cb710ba60cc0829
push id34820
push useralwu@mozilla.com
push dateMon, 07 Nov 2016 09:49:47 +0000
bugs1300016
milestone52.0a1
Bug 1300016 - only suspend web-speech when mUtterance exists. MozReview-Commit-ID: E29qJ1sgZ5c
dom/media/webspeech/synth/nsSpeechTask.cpp
--- a/dom/media/webspeech/synth/nsSpeechTask.cpp
+++ b/dom/media/webspeech/synth/nsSpeechTask.cpp
@@ -742,16 +742,20 @@ nsSpeechTask::WindowVolumeChanged(float 
 {
   SetAudioOutputVolume(aMuted ? 0.0 : mVolume * aVolume);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSpeechTask::WindowSuspendChanged(nsSuspendedTypes aSuspend)
 {
+  if (!mUtterance) {
+    return NS_OK;
+  }
+
   if (aSuspend == nsISuspendedTypes::NONE_SUSPENDED &&
       mUtterance->mPaused) {
     Resume();
   } else if (aSuspend != nsISuspendedTypes::NONE_SUSPENDED &&
              !mUtterance->mPaused) {
     Pause();
   }
   return NS_OK;