From 7ea7fadd60ca19468e1b8c7bd9c5737f8cd9b250 Mon Sep 17 00:00:00 2001 From: TaaviE Date: Mon, 27 Jul 2020 17:55:16 +0300 Subject: [PATCH] Made Mi Band activity fetching not crash the application --- .../devices/miband/operations/FetchActivityOperation.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/FetchActivityOperation.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/FetchActivityOperation.java index a841e6896..b526ec314 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/FetchActivityOperation.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband/operations/FetchActivityOperation.java @@ -153,6 +153,14 @@ public class FetchActivityOperation extends AbstractMiBand1Operation { public FetchActivityOperation(MiBandSupport support) { super(support); + if (support == null) { + LOG.error("MiBandSupport was null"); + return; + } + if (support.getDeviceInfo() == null) { + LOG.error("MiBandSupport getDeviceInfo returned null"); + return; + } hasExtendedActivityData = support.getDeviceInfo().supportsHeartrate(); hasPacketCounter = support.getDeviceInfo().getProfileVersion() >= 0x02000700; //temporary buffer, size is a multiple of 60 because we want to store complete minutes (1 minute = 3 or 4 bytes)