diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java index a3bc8511b8..565636a120 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java @@ -312,16 +312,11 @@ public class ConcatenatingMediaSource extends CompositeMediaSource= mediaSourcesPublic.size()) { - throw new IndexOutOfBoundsException(String.format("Cannot remove source range: initial index (%d) out of bounds", fromIndex)); - } - if (toIndex < 0 || toIndex > mediaSourcesPublic.size()) { - throw new IndexOutOfBoundsException(String.format("Cannot remove source range: final index (%d) out of bounds", toIndex)); - } - if (fromIndex > toIndex) { - throw new IndexOutOfBoundsException(String.format("Cannot remove source range: range malformed (%d, %d)", fromIndex, toIndex)); - } + Util.removeRange(mediaSourcesPublic, fromIndex, toIndex); if (fromIndex == toIndex) { if (actionOnCompletion != null) { actionOnCompletion.run(); } return; } - mediaSourcesPublic.subList(fromIndex, toIndex).clear(); if (player != null) { player .createMessage(this)