Bug 923704 - AudioChannelService should check if obs is null before using it, r=ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 08 Oct 2013 08:27:23 +0200
changeset 150066 5c23662223d6e9fc6a48633d3692c3d614c86cb0
parent 150065 a406c4dd141849227e5578446f457e1f2342af94
child 150067 67595062eee3bb6764d7778d1c204b60e7aa9462
push idunknown
push userunknown
push dateunknown
reviewersehsan
bugs923704
milestone27.0a1
Bug 923704 - AudioChannelService should check if obs is null before using it, r=ehsan
dom/audiochannel/AudioChannelService.cpp
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -490,30 +490,34 @@ AudioChannelService::SendAudioChannelCha
 
     nsString channelName;
     if (mCurrentHigherChannel != AUDIO_CHANNEL_LAST) {
       channelName.AssignASCII(ChannelName(mCurrentHigherChannel));
     } else {
       channelName.AssignLiteral("none");
     }
 
-    obs->NotifyObservers(nullptr, "audio-channel-changed", channelName.get());
+    if (obs) {
+      obs->NotifyObservers(nullptr, "audio-channel-changed", channelName.get());
+    }
   }
 
   if (visibleHigher != mCurrentVisibleHigherChannel) {
     mCurrentVisibleHigherChannel = visibleHigher;
 
     nsString channelName;
     if (mCurrentVisibleHigherChannel != AUDIO_CHANNEL_LAST) {
       channelName.AssignASCII(ChannelName(mCurrentVisibleHigherChannel));
     } else {
       channelName.AssignLiteral("none");
     }
 
-    obs->NotifyObservers(nullptr, "visible-audio-channel-changed", channelName.get());
+    if (obs) {
+      obs->NotifyObservers(nullptr, "visible-audio-channel-changed", channelName.get());
+    }
   }
 }
 
 PLDHashOperator
 AudioChannelService::NotifyEnumerator(AudioChannelAgent* aAgent,
                                       AudioChannelAgentData* aData, void* aUnused)
 {
   MOZ_ASSERT(aAgent);