add a null check at setting video size

This commit is contained in:
tibbi 2017-05-19 20:51:30 +02:00
parent 9e788d9453
commit 8603661873

View file

@ -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