Merge pull request #5149 from ByteHamster/fix-npe

Fixed NPE in ExternalPlayerFragment
This commit is contained in:
ByteHamster 2021-05-08 12:07:16 +02:00 committed by GitHub
commit 4b1d743ba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,8 +79,10 @@ public class ExternalPlayerFragment extends Fragment {
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
butPlay.setOnClickListener(v -> { butPlay.setOnClickListener(v -> {
if (controller != null) { if (controller == null) {
if (controller.getMedia().getMediaType() == MediaType.VIDEO return;
}
if (controller.getMedia() != null && controller.getMedia().getMediaType() == MediaType.VIDEO
&& controller.getStatus() != PlayerStatus.PLAYING) { && controller.getStatus() != PlayerStatus.PLAYING) {
controller.playPause(); controller.playPause();
getContext().startActivity(PlaybackService getContext().startActivity(PlaybackService
@ -88,8 +90,6 @@ public class ExternalPlayerFragment extends Fragment {
} else { } else {
controller.playPause(); controller.playPause();
} }
}
}); });
loadMediaInfo(); loadMediaInfo();
} }