From 53fe1973e5c47589601ccc8be56fecb42ab5beb3 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Thu, 3 Nov 2022 23:06:12 +0100 Subject: [PATCH] fix: review safety checks --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 520ec3ce..375c58db 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -454,7 +454,7 @@ class ReactExoplayerView extends FrameLayout implements * Adding Player control to the frame layout */ private void addPlayerControl() { - if(player == null) return; + if(playerControlView == null) return; LayoutParams layoutParams = new LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); @@ -1802,7 +1802,7 @@ class ReactExoplayerView extends FrameLayout implements | SYSTEM_UI_FLAG_FULLSCREEN; } eventEmitter.fullscreenWillPresent(); - if (controls) { + if (controls && fullScreenPlayerView != null) { fullScreenPlayerView.show(); } post(() -> { @@ -1812,7 +1812,7 @@ class ReactExoplayerView extends FrameLayout implements } else { uiOptions = View.SYSTEM_UI_FLAG_VISIBLE; eventEmitter.fullscreenWillDismiss(); - if (controls) { + if (controls && fullScreenPlayerView != null) { fullScreenPlayerView.dismiss(); reLayout(exoPlayerView); } @@ -1889,7 +1889,6 @@ class ReactExoplayerView extends FrameLayout implements */ public void setControls(boolean controls) { this.controls = controls; - if (player == null || exoPlayerView == null) return; if (controls) { addPlayerControl(); } else {