Do not accept negative step/intensity values in the db
(Ignore and log those requests instead)
This commit is contained in:
parent
c5db816cd1
commit
4b4c6d1a6b
|
@ -117,6 +117,15 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper implements DBHandl
|
|||
*/
|
||||
@Override
|
||||
public void addGBActivitySample(int timestamp, byte provider, short intensity, short steps, byte kind) {
|
||||
if (intensity < 0) {
|
||||
LOG.error("negative intensity received, ignoring");
|
||||
intensity = 0;
|
||||
}
|
||||
if (steps < 0) {
|
||||
LOG.error("negative steps received, ignoring");
|
||||
steps = 0;
|
||||
}
|
||||
|
||||
try (SQLiteDatabase db = this.getWritableDatabase()) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(KEY_TIMESTAMP, timestamp);
|
||||
|
|
Loading…
Reference in New Issue