diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-09-05 19:18:03 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-09-05 19:18:03 -0700 |
commit | 5dfa26f058dd7d11dd5a1ff0dbf929fa1042dfeb (patch) | |
tree | 46865f86bb299fe5bacd82c004dc706310538d60 /src | |
parent | 703e6ac05d45851aeab085a18ca1c87d84d2b7a9 (diff) | |
download | dsub-5dfa26f058dd7d11dd5a1ff0dbf929fa1042dfeb.tar.gz dsub-5dfa26f058dd7d11dd5a1ff0dbf929fa1042dfeb.tar.bz2 dsub-5dfa26f058dd7d11dd5a1ff0dbf929fa1042dfeb.zip |
Fix error on empty playlists
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/fragments/NowPlayingFragment.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java b/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java index 522b2841..82f82064 100644 --- a/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java +++ b/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java @@ -377,8 +377,12 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis if(downloadService == null) {
return;
}
-
- Entry entry = downloadService.getCurrentPlaying().getSong();
+
+ DownloadFile downloadFile = downloadService.getCurrentPlaying();
+ if(downloadFile == null) {
+ return;
+ }
+ Entry entry = downloadFile.getSong();
// If rating == 1, already set so unset
if(entry.getRating() == 1) {
@@ -409,7 +413,16 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis rateGoodButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- Entry entry = getDownloadService().getCurrentPlaying().getSong();
+ DownloadService downloadService = getDownloadService();
+ if(downloadService == null) {
+ return;
+ }
+
+ DownloadFile downloadFile = downloadService.getCurrentPlaying();
+ if(downloadFile == null) {
+ return;
+ }
+ Entry entry = downloadFile.getSong();
// If rating == 5, already set so unset
if(entry.getRating() == 5) {
|