Fixed NPE where trying to play null file

Stack trace contains headset button handler, so I guess the media is not loaded correctly.
This commit is contained in:
ByteHamster 2019-07-23 20:56:34 +02:00
parent 4551b1fbc9
commit 76f9040184
1 changed files with 1 additions and 1 deletions

View File

@ -243,7 +243,7 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
callback.onMediaChanged(false);
if (stream) {
mediaPlayer.setDataSource(media.getStreamUrl());
} else if (new File(media.getLocalMediaUrl()).canRead()) {
} else if (media.getLocalMediaUrl() != null && new File(media.getLocalMediaUrl()).canRead()) {
mediaPlayer.setDataSource(media.getLocalMediaUrl());
} else {
throw new IOException("Unable to read local file " + media.getLocalMediaUrl());