Avoid crash when chipgroup is unchecked

feature/top10
Laurent 7 years ago
parent 71cc891e81
commit 0c5af6d8d2
  1. 7
      app/src/main/java/net/pokeranalytics/android/ui/fragment/StatisticDetailsFragment.kt

@ -120,11 +120,18 @@ class StatisticDetailsFragment : PokerAnalyticsFragment() {
}
this.chipGroup.isVisible = displayAggregationChoices
this.chipGroup.setSingleSelection(true)
this.chipGroup.check(0)
this.chipGroup.setOnCheckedChangeListener(object : ChipGroupExtension.SingleSelectionOnCheckedListener() {
override fun onCheckedChanged(group: ChipGroup, checkedId: Int) {
super.onCheckedChanged(group, checkedId)
@SuppressWarnings
if (checkedId < 0) { // when unchecked, checkedId returns -1, causing a crash
return
}
val aggregationType = aggregationTypes[checkedId]
when (aggregationType) {

Loading…
Cancel
Save