Avoid crash when chipgroup is unchecked

dev
Laurent 7 years ago
parent e7c19540c2
commit 0426442e08
  1. 7
      app/src/main/java/net/pokeranalytics/android/ui/fragment/StatisticDetailsFragment.kt

@ -118,11 +118,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