From 5ce2f1763d061d63f9d2f95e94da0a5441328c20 Mon Sep 17 00:00:00 2001 From: tonihei Date: Mon, 22 Oct 2018 03:31:38 -0700 Subject: [PATCH] Check if source has been prepared before releasing it. In ConcatenatingMediaSource, the source may be removed before it started preparing (this may happen if lazyPreparation=true). In this case, we shouldn't call releaseSource as the preparation didn't start. Issue:#4986 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=218141658 --- RELEASENOTES.md | 3 +++ .../source/ConcatenatingMediaSource.java | 18 ++++++++++++------ .../source/ConcatenatingMediaSourceTest.java | 16 ++++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 060b5f4daf..17e445dd98 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -30,6 +30,9 @@ * IMA extension: * For preroll to live stream transitions, project forward the loading position to avoid being behind the live window. +* Fix issue where a `NullPointerException` is thrown when removing an unprepared + media source from a `ConcatenatingMediaSource` with the `useLazyPreparation` + option enabled ([#4986](https://github.com/google/ExoPlayer/issues/4986)). ### 2.9.0 ### 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 fb99eef6e7..830ab52e19 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 @@ -502,9 +502,7 @@ public class ConcatenatingMediaSource extends CompositeMediaSource