Merge pull request #783 from TomHennen/fix_npe_on_shutdown
Fixes NPE in PlaybackWidgetService
This commit is contained in:
commit
4e78205e62
|
@ -52,11 +52,11 @@ public class PlayerWidgetService extends Service {
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
Log.d(TAG, "Service is about to be destroyed");
|
Log.d(TAG, "Service is about to be destroyed");
|
||||||
|
if (playbackService != null) {
|
||||||
Playable playable = playbackService.getPlayable();
|
Playable playable = playbackService.getPlayable();
|
||||||
if(playable != null && playable instanceof FeedMedia) {
|
if (playable != null && playable instanceof FeedMedia) {
|
||||||
FeedMedia media = (FeedMedia) playable;
|
FeedMedia media = (FeedMedia) playable;
|
||||||
if(media.hasAlmostEnded()) {
|
if (media.hasAlmostEnded()) {
|
||||||
Log.d(TAG, "smart mark as read");
|
Log.d(TAG, "smart mark as read");
|
||||||
FeedItem item = media.getItem();
|
FeedItem item = media.getItem();
|
||||||
DBWriter.markItemRead(this, item, true, false);
|
DBWriter.markItemRead(this, item, true, false);
|
||||||
|
@ -68,6 +68,7 @@ public class PlayerWidgetService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
unbindService(mConnection);
|
unbindService(mConnection);
|
||||||
|
|
Loading…
Reference in New Issue