1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01: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:
cpfeiffer 2015-09-09 20:46:50 +02:00
parent 7f331a1bb1
commit e34c5614d7

View File

@ -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