From af10677157793896c7aa78a0fd043c0d5e7a3029 Mon Sep 17 00:00:00 2001 From: Arjan Schrijver Date: Thu, 2 Jan 2025 16:58:07 +0100 Subject: [PATCH] Colmi R09: Do not try to parse temperature packets without data --- .../gadgetbridge/devices/colmi/ColmiR0xPacketHandler.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/colmi/ColmiR0xPacketHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/colmi/ColmiR0xPacketHandler.java index db19071ac..764378f6f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/colmi/ColmiR0xPacketHandler.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/colmi/ColmiR0xPacketHandler.java @@ -494,6 +494,10 @@ public class ColmiR0xPacketHandler { public static void historicalTemperature(GBDevice device, byte[] value) { ArrayList temperatureSamples = new ArrayList<>(); int length = BLETypeConversions.toUint16(value[2], value[3]); + if (length < 50) { + LOG.info("Received temperature data packet with length {} while expecting 50. Will not try to parse it.", length); + return; + } int index = 6; // start of data (day nr, followed by values) int days_ago = -1; while (days_ago != 0 && index - 6 < length) {