From 9eeff3fabcc00abc9dd8cdabe9eaf342e2b1bd9a Mon Sep 17 00:00:00 2001 From: Nite Date: Tue, 20 Oct 2020 11:29:05 +0200 Subject: [PATCH] Fixed clearing the playlist when MediaPlayerService isn't running --- .../ultrasonic/service/MediaPlayerControllerImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerControllerImpl.java b/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerControllerImpl.java index 5d2d7f26..740e9b41 100644 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerControllerImpl.java +++ b/ultrasonic/src/main/java/org/moire/ultrasonic/service/MediaPlayerControllerImpl.java @@ -361,7 +361,16 @@ public class MediaPlayerControllerImpl implements MediaPlayerController public synchronized void clear(boolean serialize) { MediaPlayerService mediaPlayerService = MediaPlayerService.getRunningInstance(); - if (mediaPlayerService != null) mediaPlayerService.clear(serialize); + if (mediaPlayerService != null) { + mediaPlayerService.clear(serialize); + } else { + // If no MediaPlayerService is available, just empty the playlist + downloader.clear(); + if (serialize) { + downloadQueueSerializer.serializeDownloadQueue(downloader.downloadList, + downloader.getCurrentPlayingIndex(), getPlayerPosition()); + } + } jukeboxMediaPlayer.getValue().updatePlaylist(); }