mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
add a medium null check at scrollStateChanged trigger
This commit is contained in:
parent
aca83d7fad
commit
498cd10ba6
1 changed files with 4 additions and 3 deletions
|
@ -730,10 +730,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
|
||||
private fun getCurrentMedium(): Medium? {
|
||||
return if (getCurrentMedia().isEmpty() || mPos == -1)
|
||||
return if (getCurrentMedia().isEmpty() || mPos == -1) {
|
||||
null
|
||||
else
|
||||
} else {
|
||||
getCurrentMedia()[Math.min(mPos, getCurrentMedia().size - 1)]
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCurrentMedia() = if (mAreSlideShowMediaVisible) mSlideshowMedia else mMedia
|
||||
|
@ -756,7 +757,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
|
||||
override fun onPageScrollStateChanged(state: Int) {
|
||||
if (state == ViewPager.SCROLL_STATE_IDLE) {
|
||||
if (state == ViewPager.SCROLL_STATE_IDLE && getCurrentMedium() != null) {
|
||||
checkOrientation()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue