Bug 1310162 - mTrack in SimpleTextTrackEvent might be null. r=jwwang a=lizzard
authorbechen <bechen@mozilla.com>
Wed, 28 Dec 2016 15:51:37 +0800
changeset 357083 ab00cca642e46f824c9120bcf50ba42646735f32
parent 357082 ed5b9c0678b09a183f947d71a12a4a9bb20a45fb
child 357084 571c1eba5b6aefe719f4d37734209be576804246
push id6738
push usercbook@mozilla.com
push dateThu, 05 Jan 2017 09:02:58 +0000
treeherdermozilla-beta@36ec7bc916d7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang, lizzard
bugs1310162
milestone51.0
Bug 1310162 - mTrack in SimpleTextTrackEvent might be null. r=jwwang a=lizzard MozReview-Commit-ID: ESqYqBem7kQ
dom/html/TextTrackManager.cpp
--- a/dom/html/TextTrackManager.cpp
+++ b/dom/html/TextTrackManager.cpp
@@ -485,21 +485,23 @@ private:
   TextTrack* mTrack;
   RefPtr<TextTrackCue> mCue;
 };
 
 class CompareSimpleTextTrackEvents {
 private:
   int32_t TrackChildPosition(SimpleTextTrackEvent* aEvent) const
   {
-    HTMLTrackElement* trackElement = aEvent->mTrack->GetTrackElement();;
-    if (!trackElement) {
-      return -1;
+    if (aEvent->mTrack) {
+      HTMLTrackElement* trackElement = aEvent->mTrack->GetTrackElement();
+      if (trackElement) {
+        return mMediaElement->IndexOf(trackElement);
+      }
     }
-    return mMediaElement->IndexOf(trackElement);
+    return -1;
   }
   HTMLMediaElement* mMediaElement;
 public:
   explicit CompareSimpleTextTrackEvents(HTMLMediaElement* aMediaElement)
   {
     mMediaElement = aMediaElement;
   }