1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Merge pull request #8661 from Stypox/player-refactor-npe

Fix random NullPointerException when adding video player view
This commit is contained in:
Stypox 2022-08-02 11:09:50 +02:00 committed by GitHub
commit 3420faab08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1312,9 +1312,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 -> {
if (binding != null) {
playerUi.removeViewFromParent(); playerUi.removeViewFromParent();
binding.playerPlaceholder.addView(playerUi.getBinding().getRoot()); binding.playerPlaceholder.addView(playerUi.getBinding().getRoot());
playerUi.setupVideoSurfaceIfNeeded(); playerUi.setupVideoSurfaceIfNeeded();
}
})); }));
} }