Fix a NullPointerException when the current metadata is null

Reload the play queue manager and set the recovery in this case, like on the current behavior (without this PR).
pull/7349/head
TiA4f8R 2021-12-09 21:55:56 +01:00
rodzic 015982bed4
commit bf02a569ee
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: E6D3E7F5949450DD
1 zmienionych plików z 9 dodań i 3 usunięć

Wyświetl plik

@ -4177,9 +4177,15 @@ public final class Player implements
final int videoRenderIndex = getVideoRendererIndex();
// We can safely assume that currentMetadata is not null (otherwise this method isn't
// called) so we can use the requireNonNull method of the Objects class.
final StreamInfo info = Objects.requireNonNull(currentMetadata).getMetadata();
// The current metadata may be null sometimes so we will be not able to execute the
// block above. Reload the play queue manager in this case.
if (currentMetadata == null) {
reloadPlayQueueManager();
setRecovery();
return;
}
final StreamInfo info = currentMetadata.getMetadata();
/* For video streams: we don't want to stream in background the video stream so if the
video stream played is not a video-only stream and if there is an audio stream available,