Fix a crash bug due to mCurrentSong == null
This happens if: * Notification is set to always * The user empties the queue This causes activeSongReplaced() to be called, so setCurrentSong(0); will be executed while mCurrentSong is already null. Updating the notification in this state crashes with a null pointer. However: The 'dangling' notification will have wrong information in this state - but it is still better than displaying an empty one as it just looks butt ugly. We whould probably, at some point, design an 'empty notification view'
This commit is contained in:
1 parent
954734de05
commit
fd3b4c152a
1 file changed
+2
-1
@@ -976,7 +976,8 @@ public final class PlaybackService extends Service
|
||||
|
||||
if (mNotificationMode == ALWAYS || mForceNotificationVisible) {
|
||||
stopForeground(false);
|
||||
mNotificationManager.notify(NOTIFICATION_ID, createNotification(mCurrentSong, mState));
|
||||
if (mCurrentSong != null)
|
||||
mNotificationManager.notify(NOTIFICATION_ID, createNotification(mCurrentSong, mState));
|
||||
} else {
|
||||
stopForeground(true);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user