add a couple null checks to viewpager pages

This commit is contained in:
tibbi 2017-03-12 16:39:58 +01:00
parent 539d1ba3d7
commit daffc7fc1d
4 changed files with 6 additions and 6 deletions

View File

@ -30,7 +30,7 @@ class MyDayPagerAdapter(fm: FragmentManager, private val mCodes: List<String>, p
fun checkDayEvents(pos: Int) { fun checkDayEvents(pos: Int) {
for (i in -1..1) { for (i in -1..1) {
mFragments[pos + i].checkEvents() mFragments[pos + i]?.checkEvents()
} }
} }
} }

View File

@ -29,7 +29,7 @@ class MyMonthPagerAdapter(fm: FragmentManager, private val mCodes: List<String>,
fun refreshEvents(pos: Int) { fun refreshEvents(pos: Int) {
for (i in -1..1) { for (i in -1..1) {
mFragments[pos + i].updateCalendar() mFragments[pos + i]?.updateCalendar()
} }
} }
} }

View File

@ -27,13 +27,13 @@ class MyWeekPagerAdapter(fm: FragmentManager, val mWeekTimestamps: List<Int>, va
} }
fun updateScrollY(pos: Int, y: Int) { fun updateScrollY(pos: Int, y: Int) {
mFragments[pos - 1].updateScrollY(y) mFragments[pos - 1]?.updateScrollY(y)
mFragments[pos + 1].updateScrollY(y) mFragments[pos + 1]?.updateScrollY(y)
} }
fun refreshEvents(pos: Int) { fun refreshEvents(pos: Int) {
for (i in -1..1) { for (i in -1..1) {
mFragments[pos + i].updateEvents() mFragments[pos + i]?.updateEvents()
} }
} }
} }

View File

@ -29,7 +29,7 @@ class MyYearPagerAdapter(fm: FragmentManager, val mYears: List<Int>, val mListen
fun refreshEvents(pos: Int) { fun refreshEvents(pos: Int) {
for (i in -1..1) { for (i in -1..1) {
mFragments[pos + i].updateEvents() mFragments[pos + i]?.updateEvents()
} }
} }
} }