1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-27 02:55:50 +01:00

Fix crash on unknown values

This commit is contained in:
José Rebelo 2024-09-30 21:19:00 +01:00 committed by José Rebelo
parent c2e2b52297
commit 86888ec52b

View File

@ -40,6 +40,10 @@ public class WorkoutValueFormatter {
} }
public String formatValue(final Object rawValue, String unit) { public String formatValue(final Object rawValue, String unit) {
if (rawValue == null) {
return GBApplication.getContext().getString(R.string.stats_empty_value);
}
if (ActivitySummaryEntries.UNIT_RAW_STRING.equals(unit)) { if (ActivitySummaryEntries.UNIT_RAW_STRING.equals(unit)) {
return String.valueOf(rawValue); return String.valueOf(rawValue);
} }
@ -54,6 +58,10 @@ public class WorkoutValueFormatter {
} }
} }
if (!(rawValue instanceof Number)) {
return String.valueOf(rawValue);
}
double value = ((Number) rawValue).doubleValue(); double value = ((Number) rawValue).doubleValue();
if (!show_raw_data) { if (!show_raw_data) {