Skip to content

Commit

Permalink
Statistics: fix crash due to division by 0
Browse files Browse the repository at this point in the history
  • Loading branch information
adrcotfas committed Nov 3, 2021
1 parent de5f40f commit 708d8c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android {
applicationId "com.apps.adrcotfas.goodtime"
minSdkVersion 23
targetSdkVersion 30
versionCode 136
versionCode 137
versionName "2.5.0"
resConfigs "ar-rSA",
"bn-rBD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ class StatisticsFragment : Fragment() {
ChartMarker.MarkerType.PERCENTAGE
)
setScaleEnabled(false)
//TODO: do we need these here?
invalidate()
notifyDataSetChanged()
}
Expand Down Expand Up @@ -822,7 +823,7 @@ class StatisticsFragment : Fragment() {
}
for (i in sessionsPerProductiveTimeType.indices) {
values[i] =
BarEntry(i.toFloat(), sessionsPerProductiveTimeType[i].toFloat() / totalTime)
BarEntry(i.toFloat(), if (totalTime == 0L) 0f else sessionsPerProductiveTimeType[i].toFloat() / totalTime)
}

} else if (productiveTimeType == SpinnerStatsType.NR_OF_SESSIONS) {
Expand Down

0 comments on commit 708d8c0

Please sign in to comment.