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,17 +79,17 @@ 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;
&& controller.getStatus() != PlayerStatus.PLAYING) { }
controller.playPause(); if (controller.getMedia() != null && controller.getMedia().getMediaType() == MediaType.VIDEO
getContext().startActivity(PlaybackService && controller.getStatus() != PlayerStatus.PLAYING) {
.getPlayerActivityIntent(getContext(), controller.getMedia())); controller.playPause();
} else { getContext().startActivity(PlaybackService
controller.playPause(); .getPlayerActivityIntent(getContext(), controller.getMedia()));
} } else {
controller.playPause();
} }
}); });
loadMediaInfo(); loadMediaInfo();
} }