From a1cdd590115bdcdd609c07cc18aee90b53c9a9c4 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 22 Oct 2015 18:34:26 -0700 Subject: Fix error if progress handlers ever fired as shutting down --- .../github/daneren2005/dsub/service/DownloadService.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'app/src/main/java/github') diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java index d33fa527..7620be48 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -2572,7 +2572,7 @@ public class DownloadService extends Service { handler.post(new Runnable() { @Override public void run() { - if(revision == atRevision) { + if(revision == atRevision && instance != null) { listener.onSongChanged(currentPlaying, currentPlayingIndex); MusicDirectory.Entry entry = currentPlaying != null ? currentPlaying.getSong() : null; @@ -2597,7 +2597,7 @@ public class DownloadService extends Service { handler.post(new Runnable() { @Override public void run() { - if(revision == atRevision) { + if(revision == atRevision && instance != null) { listener.onSongsChanged(downloadList, currentPlaying, currentPlayingIndex); } } @@ -2613,7 +2613,7 @@ public class DownloadService extends Service { handler.post(new Runnable() { @Override public void run() { - if(revision == atRevision) { + if(revision == atRevision && instance != null) { listener.onSongProgress(currentPlaying, position, duration, isSeekable); } } @@ -2633,7 +2633,7 @@ public class DownloadService extends Service { handler.post(new Runnable() { @Override public void run() { - if(revision == atRevision) { + if(revision == atRevision && instance != null) { listener.onStateUpdate(currentPlaying, playerState); } } @@ -2648,8 +2648,10 @@ public class DownloadService extends Service { handler.post(new Runnable() { @Override public void run() { - MusicDirectory.Entry entry = currentPlaying != null ? currentPlaying.getSong() : null; - listener.onMetadataUpdate(entry, updateType); + if(instance != null) { + MusicDirectory.Entry entry = currentPlaying != null ? currentPlaying.getSong() : null; + listener.onMetadataUpdate(entry, updateType); + } } }); } -- cgit v1.2.3