Skip to content

Commit

Permalink
Return 0 when progress is NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoASantos committed Sep 26, 2024
1 parent dd66cf6 commit 1a652e4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,11 @@ class NotificationListenerService : NotificationListenerService() {
bigText.split("\n").firstOrNull { it.contains("%") }?.toString()
?.substringBefore("%")?.toFloatOrNull() ?:
textLines?.firstOrNull { it.contains("%") }?.toString()
?.substringBefore("%")?.toFloatOrNull() ?: 0f
?.substringBefore("%")?.toFloatOrNull()

if (percentageProgress == null || percentageProgress.isNaN()) {
return 0
}

return percentageProgress.roundToInt()
}
Expand Down

0 comments on commit 1a652e4

Please sign in to comment.