mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 04:22:30 +01:00
Merge pull request #10577 from AudricV/fix-npe-play-queue-audio-track-menu
Fix crash when building the play queue audio track menu if the player is null
This commit is contained in:
commit
3dc593fe88
@ -619,11 +619,13 @@ public final class PlayQueueActivity extends AppCompatActivity
|
||||
|
||||
final MenuItem audioTrackSelector = menu.findItem(R.id.action_audio_track);
|
||||
final List<AudioStream> availableStreams =
|
||||
Optional.ofNullable(player.getCurrentMetadata())
|
||||
Optional.ofNullable(player)
|
||||
.map(Player::getCurrentMetadata)
|
||||
.flatMap(MediaItemTag::getMaybeAudioTrack)
|
||||
.map(MediaItemTag.AudioTrack::getAudioStreams)
|
||||
.orElse(null);
|
||||
final Optional<AudioStream> selectedAudioStream = player.getSelectedAudioStream();
|
||||
final Optional<AudioStream> selectedAudioStream = Optional.ofNullable(player)
|
||||
.flatMap(Player::getSelectedAudioStream);
|
||||
|
||||
if (availableStreams == null || availableStreams.size() < 2
|
||||
|| selectedAudioStream.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user