From c235c647a0e09cf8af3f08aa4c403b0bbdb9cd3b Mon Sep 17 00:00:00 2001 From: John Zhen M Date: Sun, 24 Sep 2017 21:10:45 -0700 Subject: [PATCH] -Fixed background player notification update NPE. --- .../org/schabi/newpipe/player/BackgroundPlayer.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java index e2a86c4bc..2f3da3b25 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java @@ -336,14 +336,18 @@ public final class BackgroundPlayer extends Service { @Override public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) { if (bigNotRemoteView != null) { - bigNotRemoteView.setTextViewText(R.id.notificationSongName, getVideoTitle()); - bigNotRemoteView.setTextViewText(R.id.notificationArtist, getUploaderName()); + if (currentInfo != null) { + bigNotRemoteView.setTextViewText(R.id.notificationSongName, getVideoTitle()); + bigNotRemoteView.setTextViewText(R.id.notificationArtist, getUploaderName()); + } bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, duration, currentProgress, false); bigNotRemoteView.setTextViewText(R.id.notificationTime, getTimeString(currentProgress) + " / " + getTimeString(duration)); } if (notRemoteView != null) { - notRemoteView.setTextViewText(R.id.notificationSongName, getVideoTitle()); - notRemoteView.setTextViewText(R.id.notificationArtist, getUploaderName()); + if (currentInfo != null) { + notRemoteView.setTextViewText(R.id.notificationSongName, getVideoTitle()); + notRemoteView.setTextViewText(R.id.notificationArtist, getUploaderName()); + } notRemoteView.setProgressBar(R.id.notificationProgressBar, duration, currentProgress, false); }