From 7da328d5dbdb325d81bbc3e07d2db87bc4d9de2e Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Thu, 24 Nov 2016 22:15:06 +0100 Subject: [PATCH] Fix an invalid leftover check for array length Also removed a method invocation that did not belong there. --- .../devices/miband2/operations/FetchActivityOperation.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/operations/FetchActivityOperation.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/operations/FetchActivityOperation.java index 92449abd..4979d70f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/operations/FetchActivityOperation.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/operations/FetchActivityOperation.java @@ -173,7 +173,7 @@ public class FetchActivityOperation extends AbstractMiBand2Operation { return; } - if (value.length == 17) { + if ((value.length % 4) == 1) { if ((byte) (lastPacketCounter + 1) == value[0] ) { lastPacketCounter++; bufferActivityData(value); @@ -182,7 +182,6 @@ public class FetchActivityOperation extends AbstractMiBand2Operation { handleActivityFetchFinish(); return; } - handleActivityMetadata(value); } else { GB.toast("Error fetching activity data, unexpected package length: " + value.length, Toast.LENGTH_LONG, GB.ERROR); }