From 3831800715cfd53bb146cd1c6a84f9e9c568fb1b Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 18 Jul 2018 14:44:52 +0200 Subject: [PATCH] adding some null checks at handling video end --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index e3e7c5a2d..27342d095 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -431,7 +431,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) } - private fun videoEnded() = mExoPlayer!!.currentPosition >= mExoPlayer!!.duration + private fun videoEnded() = mExoPlayer?.currentPosition ?: 0 >= mExoPlayer?.duration ?: 0 private fun setProgress(seconds: Int) { mExoPlayer!!.seekTo(seconds * 1000L)