Skip to content

Commit

Permalink
- protect against potential NPE due to tag not containing DrawerItem
Browse files Browse the repository at this point in the history
  - FIX #2732
  • Loading branch information
mikepenz committed Jul 20, 2021
1 parent a032593 commit 6cbddd6
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,18 @@ internal fun rebuildStickyFooterView(sliderView: MaterialDrawerSliderView) {

//fill the footer with items
fillStickyDrawerItemFooter(sliderView, it) { v ->
val drawerItem = v.getTag(R.id.material_drawer_item) as IDrawerItem<*>
onFooterDrawerItemClick(sliderView, drawerItem, v, true)
(v.getTag(R.id.material_drawer_item) as? IDrawerItem<*>)?.let { drawerItem ->
onFooterDrawerItemClick(sliderView, drawerItem, v, true)
}
}

it.visibility = View.VISIBLE
} ?: run {
//there was no footer yet. now just create one
handleFooterView(sliderView) { v ->
val drawerItem = v.getTag(R.id.material_drawer_item) as IDrawerItem<*>
onFooterDrawerItemClick(sliderView, drawerItem, v, true)
(v.getTag(R.id.material_drawer_item) as? IDrawerItem<*>)?.let { drawerItem ->
onFooterDrawerItemClick(sliderView, drawerItem, v, true)
}
}
}

Expand Down

0 comments on commit 6cbddd6

Please sign in to comment.