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 349999 3707e4b400f80aefb107516d9595df7243982849
parent 349998 7246c7c5b073889f5378b4cda827cbd519680a0f
child 350000 41dfabec7e72f58119aac0054ac192de66bcde42
push id10519
push usercbook@mozilla.com
push dateThu, 05 Jan 2017 07:55:18 +0000
treeherdermozilla-aurora@75a0d7ccab1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang, lizzard
bugs1310162
milestone52.0a2
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
@@ -486,21 +486,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;
   }