Merge pull request #3115 from ByteHamster/small-crash

Fixed NPE
This commit is contained in:
H. Lehmann 2019-04-14 13:59:29 +02:00 committed by GitHub
commit 5d459b5327
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

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