Bug 876856: check if PeerConnection is closed before accessing MediaStreamList r=ekr
authorRandell Jesup <rjesup@jesup.org>
Thu, 30 May 2013 16:48:31 -0400
changeset 133562 324169b939ae
parent 133561 c4912157c2d0
child 133563 758527363f29
push id24757
push userryanvm@gmail.com
push dateFri, 31 May 2013 20:11:58 +0000
treeherdermozilla-central@2222b07ab207 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersekr
bugs876856
milestone24.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 876856: check if PeerConnection is closed before accessing MediaStreamList r=ekr
media/webrtc/signaling/src/peerconnection/MediaStreamList.cpp
--- a/media/webrtc/signaling/src/peerconnection/MediaStreamList.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaStreamList.cpp
@@ -57,26 +57,33 @@ GetStreamFromInfo(T* info, bool& found)
 
   found = true;
   return info->GetMediaStream();
 }
 
 DOMMediaStream*
 MediaStreamList::IndexedGetter(uint32_t index, bool& found)
 {
+  if (!mPeerConnection->media()) { // PeerConnection closed
+    found = false;
+    return nullptr;
+  }
   if (mType == Local) {
     return GetStreamFromInfo(mPeerConnection->media()->
       GetLocalStream(index), found);
   }
 
   return GetStreamFromInfo(mPeerConnection->media()->
     GetRemoteStream(index), found);
 }
 
 uint32_t
 MediaStreamList::Length()
 {
+  if (!mPeerConnection->media()) { // PeerConnection closed
+    return 0;
+  }
   return mType == Local ? mPeerConnection->media()->LocalStreamsLength() :
       mPeerConnection->media()->RemoteStreamsLength();
 }
 
 } // namespace dom
 } // namespace mozilla