From d4c9be2ba09dd410f0d878ce3f6a1cca987f6713 Mon Sep 17 00:00:00 2001 From: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> Date: Fri, 17 May 2024 15:16:48 +0200 Subject: [PATCH] fix(android): random android crash (#3777) * perf: ensure we do not provide callback to native if no callback provided from app * chore: rework bufferConfig to make it more generic and reduce ReactExoplayerView code size * chore: improve issue template * fix(android): avoid video view flickering at playback startup * fix(android): fix random crash --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 76ca9811..9bd900f4 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -1707,8 +1707,10 @@ public class ReactExoplayerView extends FrameLayout implements public void clearSrc() { if (srcUri != null) { - player.stop(); - player.clearMediaItems(); + if (player != null) { + player.stop(); + player.clearMediaItems(); + } this.srcUri = null; this.startPositionMs = -1; this.cropStartMs = -1;