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) {
super.onActivityCreated(savedInstanceState);
butPlay.setOnClickListener(v -> {
if (controller != null) {
if (controller.getMedia().getMediaType() == MediaType.VIDEO
&& controller.getStatus() != PlayerStatus.PLAYING) {
controller.playPause();
getContext().startActivity(PlaybackService
.getPlayerActivityIntent(getContext(), controller.getMedia()));
} else {
controller.playPause();
}
if (controller == null) {
return;
}
if (controller.getMedia() != null && controller.getMedia().getMediaType() == MediaType.VIDEO
&& controller.getStatus() != PlayerStatus.PLAYING) {
controller.playPause();
getContext().startActivity(PlaybackService
.getPlayerActivityIntent(getContext(), controller.getMedia()));
} else {
controller.playPause();
}
});
loadMediaInfo();
}