Delegated error handling properly to the function that creates FetchActivityOperation

This commit is contained in:
TaaviE
2020-07-28 08:11:50 +02:00
committed by Gitea
parent bcac8e0d7f
commit 3ad1412a1d
@@ -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;