Skip to content

Commit b40112e

Browse files
authored
fix: power source crash (#1494)
1 parent 938c061 commit b40112e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/src/main/java/io/pslab/activity/PowerSourceActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,11 @@ private int mapPowerToProgress(float power, int CONTROLLER_MAX, float max, float
640640
* @return truncated float value
641641
*/
642642
private float limitDigits(float number) {
643-
return Float.valueOf(String.format(Locale.getDefault(), "%.2f", number));
643+
try {
644+
return Float.valueOf(String.format(Locale.getDefault(), "%.2f", number));
645+
} catch (NumberFormatException e) {
646+
return 0.00f;
647+
}
644648
}
645649

646650
/**

0 commit comments

Comments
 (0)