make sure the video fragment still exists when the video completes

This commit is contained in:
tibbi 2017-10-28 19:05:51 +02:00
parent 883e3ad6c1
commit 75c9d28547
2 changed files with 6 additions and 1 deletions

View file

@ -464,6 +464,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
} }
private fun videoCompleted() { private fun videoCompleted() {
if (!isAdded) {
return
}
if (listener?.videoEnded() == false && context.config.loopVideos) { if (listener?.videoEnded() == false && context.config.loopVideos) {
playVideo() playVideo()
} else { } else {

View file

@ -20,8 +20,9 @@ abstract class ViewPagerFragment : Fragment() {
fun getMediumExtendedDetails(medium: Medium): String { fun getMediumExtendedDetails(medium: Medium): String {
val file = File(medium.path) val file = File(medium.path)
if (!file.exists()) if (!file.exists()) {
return "" return ""
}
val path = "${file.parent.trimEnd('/')}/" val path = "${file.parent.trimEnd('/')}/"
val exif = android.media.ExifInterface(medium.path) val exif = android.media.ExifInterface(medium.path)