1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-06-16 18:30:00 +00:00

Fix random NullPointerException when adding video player view

This commit is contained in:
Stypox 2022-07-19 20:01:46 +02:00
parent ae369ec9ba
commit 4eddd2c3d1
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

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