From 8b1080d5ccc2428d81ff71a9ff4a0cc18b4f672b 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 cd8caa0c8a..ba1734bc30 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -23,6 +23,9 @@ ([#4532](https://github.com/google/ExoPlayer/issues/4532)). * Suppress spurious "references unknown class member" shrinking warning ([#4890](https://github.com/google/ExoPlayer/issues/4890)). +* 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 7418e84449..1b614e18a9 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