Fix random NullPointerException when adding video player view

pull/8661/head
Stypox 2022-07-19 20:01:46 +02:00
rodzic ae369ec9ba
commit 4eddd2c3d1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4BDF1B40A49FDD23
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -1313,9 +1313,11 @@ public final class VideoDetailFragment
// Prevent from re-adding a view multiple times // Prevent from re-adding a view multiple times
new Handler(Looper.getMainLooper()).post(() -> new Handler(Looper.getMainLooper()).post(() ->
player.UIs().get(MainPlayerUi.class).ifPresent(playerUi -> { player.UIs().get(MainPlayerUi.class).ifPresent(playerUi -> {
playerUi.removeViewFromParent(); if (binding != null) {
binding.playerPlaceholder.addView(playerUi.getBinding().getRoot()); playerUi.removeViewFromParent();
playerUi.setupVideoSurfaceIfNeeded(); binding.playerPlaceholder.addView(playerUi.getBinding().getRoot());
playerUi.setupVideoSurfaceIfNeeded();
}
})); }));
} }