aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-10-22 18:34:26 -0700
committerScott Jackson <daneren2005@gmail.com>2015-10-22 18:34:26 -0700
commita1cdd590115bdcdd609c07cc18aee90b53c9a9c4 (patch)
treead4dcbb02a926b24a2ae5b87da358f47a2dc1620
parent0b16cf95e6bb9d197f837dc38761b6a5394e6726 (diff)
downloaddsub-a1cdd590115bdcdd609c07cc18aee90b53c9a9c4.tar.gz
dsub-a1cdd590115bdcdd609c07cc18aee90b53c9a9c4.tar.bz2
dsub-a1cdd590115bdcdd609c07cc18aee90b53c9a9c4.zip
Fix error if progress handlers ever fired as shutting down
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/DownloadService.java14
1 files changed, 8 insertions, 6 deletions
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);
+ }
}
});
}