1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-02-17 21:06:48 +01:00

Delegated error handling properly to the function that creates FetchActivityOperation

This commit is contained in:
TaaviE 2020-07-28 04:03:34 +03:00 committed by Gitea
parent bcac8e0d7f
commit 3ad1412a1d

View File

@ -151,15 +151,13 @@ public class FetchActivityOperation extends AbstractMiBand1Operation {
private ActivityStruct activityStruct; private ActivityStruct activityStruct;
public FetchActivityOperation(MiBandSupport support) { public FetchActivityOperation(MiBandSupport support) throws IOException {
super(support); super(support);
if (support == null) { if (support == null) {
LOG.error("MiBandSupport was null"); throw new IOException("MiBandSupport was null");
return;
} }
if (support.getDeviceInfo() == null) { if (support.getDeviceInfo() == null) {
LOG.error("MiBandSupport getDeviceInfo returned null"); throw new IOException("MiBandSupport getDeviceInfo returned null");
return;
} }
hasExtendedActivityData = support.getDeviceInfo().supportsHeartrate(); hasExtendedActivityData = support.getDeviceInfo().supportsHeartrate();
hasPacketCounter = support.getDeviceInfo().getProfileVersion() >= 0x02000700; hasPacketCounter = support.getDeviceInfo().getProfileVersion() >= 0x02000700;