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:
parent
7f331a1bb1
commit
e34c5614d7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user