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 470e2b986..8985628c1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -464,6 +464,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } private fun videoCompleted() { + if (!isAdded) { + return + } + if (listener?.videoEnded() == false && context.config.loopVideos) { playVideo() } else { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt index e495e4168..20a73b886 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt @@ -20,8 +20,9 @@ abstract class ViewPagerFragment : Fragment() { fun getMediumExtendedDetails(medium: Medium): String { val file = File(medium.path) - if (!file.exists()) + if (!file.exists()) { return "" + } val path = "${file.parent.trimEnd('/')}/" val exif = android.media.ExifInterface(medium.path)