Skip to content

Commit

Permalink
Progress wrapper division by zero (#740)
Browse files Browse the repository at this point in the history
**Background**

Now we have crash when file size equals

**Changes**

* Check divisions by zero, so set max percentage

**Test plan**

* Try use .mfkey32.log size equals zero

Fix #739
  • Loading branch information
Programistich authored Nov 15, 2023
1 parent a6533b5 commit ef27b6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
- [Feature] Optimization FapHub by compose metrics
- [Feature] Firmware update notification
- [FIX] Splashscreen WearOS icon
- [FIX] Handle expired link
- [FIX] Handle expired link
- [FIX] Progress wrapper division by zero

# 1.6.6

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ class ProgressWrapperTracker(
}
return
}
if (max == 0L) {
onProgress(MAX_PERCENT)
if (BuildConfig.DEBUG) {
error("Max is zero")
}
return
}

val percent = current.toDouble() / max
onProgress(percent.toFloat())
}
Expand Down

0 comments on commit ef27b6b

Please sign in to comment.