mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Bail out hard if we get negative steps from the database #91
We don't add them to the db for sure.
This commit is contained in:
@@ -16,6 +16,19 @@ public class GBActivitySample implements ActivitySample {
|
||||
this.intensity = intensity;
|
||||
this.steps = steps;
|
||||
this.type = type;
|
||||
validate();
|
||||
}
|
||||
|
||||
private void validate() {
|
||||
if (steps < 0) {
|
||||
throw new IllegalArgumentException("steps must be > 0");
|
||||
}
|
||||
if (intensity < 0) {
|
||||
throw new IllegalArgumentException("intensity must be > 0");
|
||||
}
|
||||
if (timestamp < 0) {
|
||||
throw new IllegalArgumentException("timestamp must be > 0");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user