From 86036618735d825850d5ff4832b59f466639aa86 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 19 May 2017 20:51:30 +0200 Subject: [PATCH] add a null check at setting video size --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 4 ++++ 1 file changed, 4 insertions(+) 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 de8af3253..0626adf14 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -14,6 +14,7 @@ import android.view.animation.AnimationUtils import android.widget.SeekBar import android.widget.TextView import com.simplemobiletools.commons.extensions.getFormattedDuration +import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.config @@ -304,6 +305,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee return initMediaPlayer() + if (mMediaPlayer == null) + activity.toast(R.string.unknown_error_occurred) + val videoProportion = mMediaPlayer!!.videoWidth.toFloat() / mMediaPlayer!!.videoHeight.toFloat() val display = activity.windowManager.defaultDisplay val screenWidth: Int