aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-10-26 10:07:28 -0700
committerScott Jackson <daneren2005@gmail.com>2014-10-26 10:07:28 -0700
commit666f6bb24019e5b8e74f5754049eda6983b7cdba (patch)
treee4a621fa3fca1396382e6135798d7c7f0f261296
parent1fa2f0825f8371be4e2302380dcc285d92ed8e95 (diff)
downloaddsub-666f6bb24019e5b8e74f5754049eda6983b7cdba.tar.gz
dsub-666f6bb24019e5b8e74f5754049eda6983b7cdba.tar.bz2
dsub-666f6bb24019e5b8e74f5754049eda6983b7cdba.zip
Fix NPE when playing from empty list
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index 69ed7c7f..a5b647a9 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -1888,6 +1888,10 @@ public class DownloadService extends Service {
return isPastCutoff(getPlayerPosition(), getPlayerDuration());
}
private boolean isPastCutoff(int position, int duration) {
+ if(currentPlaying == null) {
+ return false;
+ }
+
int cutoffPoint = (int) (duration * DELETE_CUTOFF);
boolean isPastCutoff = duration > 0 && position > cutoffPoint;