From 4c2c330cbc9ff055d675c6772fdc2fdb5e9c75f5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 28 Feb 2020 22:53:08 +0100 Subject: [PATCH] check null exoplayer at skipping --- .../gallery/pro/activities/VideoPlayerActivity.kt | 4 ++++ .../simplemobiletools/gallery/pro/fragments/VideoFragment.kt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index a432ca076..282b7d165 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -503,6 +503,10 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen } private fun doSkip(forward: Boolean) { + if (mExoPlayer == null) { + return + } + val curr = mExoPlayer!!.currentPosition val newProgress = if (forward) curr + FAST_FORWARD_VIDEO_MS else curr - FAST_FORWARD_VIDEO_MS val roundProgress = Math.round(newProgress / 1000f) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 3944ceabb..e2f3c6ecb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -546,6 +546,10 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } private fun doSkip(forward: Boolean) { + if (mExoPlayer == null) { + return + } + val curr = mExoPlayer!!.currentPosition val newProgress = if (forward) curr + FAST_FORWARD_VIDEO_MS else curr - FAST_FORWARD_VIDEO_MS val roundProgress = Math.round(newProgress / 1000f)