adding some null checks

This commit is contained in:
tibbi 2018-01-23 21:16:58 +01:00
parent 2606456255
commit d2d5f306e2
2 changed files with 5 additions and 5 deletions

View File

@ -111,10 +111,10 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
if (viewpager.adapter == null) {
initFragments()
}
contacts_fragment.initContacts()
contacts_fragment.onActivityResume()
favorites_fragment.initContacts()
favorites_fragment.onActivityResume()
contacts_fragment?.initContacts()
contacts_fragment?.onActivityResume()
favorites_fragment?.initContacts()
favorites_fragment?.onActivityResume()
}
isFirstResume = false
}

View File

@ -179,7 +179,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
}
fun onSearchOpened() {
contactsIgnoringSearch = (fragment_list.adapter as ContactsAdapter).contactItems as ArrayList
contactsIgnoringSearch = (fragment_list.adapter as? ContactsAdapter)?.contactItems as ArrayList
}
fun onSearchClosed() {