From aac4a0cd670e64fb78d48d8e6846b516f29f95e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey?= Date: Wed, 4 May 2022 11:23:54 +0200 Subject: [PATCH] PreviewMediaFragment: prevent crash due to onStop called before exoplayer initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Brey --- .../com/owncloud/android/ui/preview/PreviewMediaFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java index a9eda30ffc..ee0854e3de 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -601,7 +601,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene final OCFile file = getFile(); if (MimeTypeUtil.isAudio(file) && !mediaPlayerServiceConnection.isPlaying()) { stopAudio(); - } else if (MimeTypeUtil.isVideo(file) && exoPlayer.isPlaying()) { + } else if (MimeTypeUtil.isVideo(file) && exoPlayer != null && exoPlayer.isPlaying()) { savedPlaybackPosition = exoPlayer.getCurrentPosition(); exoPlayer.pause(); }