Fixed NPE

This commit is contained in:
ByteHamster 2019-04-13 16:01:17 +02:00
parent 7c4d4656f8
commit f947b0a90d
1 changed files with 4 additions and 1 deletions

View File

@ -145,6 +145,7 @@ public class ExternalPlayerFragment extends Fragment {
super.onStart();
controller = setupPlaybackController();
controller.init();
loadMediaInfo();
EventBus.getDefault().register(this);
}
@ -250,7 +251,9 @@ public class ExternalPlayerFragment extends Fragment {
}
private void onPositionObserverUpdate() {
if (controller.getPosition() == PlaybackService.INVALID_TIME
if (controller == null) {
return;
} else if (controller.getPosition() == PlaybackService.INVALID_TIME
|| controller.getDuration() == PlaybackService.INVALID_TIME) {
return;
}