From 9e1aff4645e4252ae46dd005a19a0c78c43df056 Mon Sep 17 00:00:00 2001 From: Christopher Eby Date: Sun, 21 Mar 2010 17:08:44 -0500 Subject: [PATCH] Fix some crashers that show up with no media Because I never seem to test this code path :) --- src/org/kreed/vanilla/PlaybackService.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/org/kreed/vanilla/PlaybackService.java b/src/org/kreed/vanilla/PlaybackService.java index c48cde13..eddf935d 100644 --- a/src/org/kreed/vanilla/PlaybackService.java +++ b/src/org/kreed/vanilla/PlaybackService.java @@ -445,12 +445,12 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On return false; Song song = getSong(0); + if (song == null && state == STATE_PLAYING) + return false; + int oldState = mState; mState = state; - if (song == null) - return false; - broadcastChange(oldState, state, song); boolean cancelNotification; @@ -499,7 +499,8 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On private boolean updateNotification(Song song) { if (song == null || !mNotifyWhilePaused && mState == STATE_NORMAL) { - mNotificationManager.cancel(NOTIFICATION_ID); + if (mNotificationManager != null) + mNotificationManager.cancel(NOTIFICATION_ID); return true; }