Bug 1387058 - part2: Early return in AudioNotificationReceiver::NotifyDefaultDeviceChanged if there is no AudioStream; r=jwwang
authorChun-Min Chang <chun.m.chang@gmail.com>
Fri, 04 Aug 2017 15:01:39 +0800
changeset 422365 cde7d3637eeee95d3787500ff689075ac4831ab1
parent 422364 357a94f6484f6aafc305fcb643686e0b8863597b
child 422366 0d9b4108bf57c329f0f4ebb752b2592af0d67a44
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang
bugs1387058
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1387058 - part2: Early return in AudioNotificationReceiver::NotifyDefaultDeviceChanged if there is no AudioStream; r=jwwang MozReview-Commit-ID: HLByqFWqCdn
dom/media/AudioNotificationReceiver.cpp
--- a/dom/media/AudioNotificationReceiver.cpp
+++ b/dom/media/AudioNotificationReceiver.cpp
@@ -63,16 +63,22 @@ AudioNotificationReceiver::Unregister(Au
 }
 
 /* static */ void
 AudioNotificationReceiver::NotifyDefaultDeviceChanged()
 {
   MOZ_ASSERT(XRE_IsContentProcess());
 
   StaticMutexAutoLock lock(sMutex);
+
+  // Do nothing when there is no AudioStream.
+  if (!sSubscribers) {
+    return;
+  }
+
   for (AudioStream* stream : *sSubscribers) {
     ANR_LOG("Notify the AudioStream: %p that the default device has been changed.", stream);
     stream->ResetDefaultDevice();
   }
 }
 
 } // namespace audio
-} // namespace mozilla
\ No newline at end of file
+} // namespace mozilla