Fix random NullPointerException when adding video player view
This commit is contained in:
parent
ae369ec9ba
commit
4eddd2c3d1
1 changed files with 5 additions and 3 deletions
|
@ -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 -> {
|
||||||
|
if (binding != null) {
|
||||||
playerUi.removeViewFromParent();
|
playerUi.removeViewFromParent();
|
||||||
binding.playerPlaceholder.addView(playerUi.getBinding().getRoot());
|
binding.playerPlaceholder.addView(playerUi.getBinding().getRoot());
|
||||||
playerUi.setupVideoSurfaceIfNeeded();
|
playerUi.setupVideoSurfaceIfNeeded();
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue