fix crash when clearing the queue

This commit is contained in:
dkanada 2020-05-23 10:29:33 +09:00
commit 207b075d13
2 changed files with 2 additions and 2 deletions

View file

@ -480,6 +480,8 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
private void openCurrent() { private void openCurrent() {
synchronized (this) { synchronized (this) {
// current song will be null when queue is cleared
if (getCurrentSong() == null) return;
playback.setDataSource(getTrackUri(getCurrentSong())); playback.setDataSource(getTrackUri(getCurrentSong()));
} }
} }

View file

@ -26,8 +26,6 @@ import java.util.Locale;
public class MusicUtil { public class MusicUtil {
public static Uri getSongFileUri(Song song) { public static Uri getSongFileUri(Song song) {
if (song.id == null) return null;
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
ApiClient apiClient = App.getApiClient(); ApiClient apiClient = App.getApiClient();