add another check at getting current media of viewpager

This commit is contained in:
tibbi 2017-05-31 23:04:56 +02:00
parent 0e38255961
commit f4ddc12911

View file

@ -498,7 +498,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
private fun getCurrentMedium(): Medium? { private fun getCurrentMedium(): Medium? {
return if (mMedia.isEmpty()) return if (mMedia.isEmpty() || mPos >= mMedia.size)
null null
else else
mMedia[Math.min(mPos, mMedia.size - 1)] mMedia[Math.min(mPos, mMedia.size - 1)]