Fix crash during discovery

This commit is contained in:
José Rebelo 2024-03-30 09:02:18 +00:00
parent 81aef0bf35
commit 904007614d
2 changed files with 8 additions and 1 deletions

View File

@ -104,7 +104,8 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
supportedDeviceName = getSupportedDeviceName();
}
if (supportedDeviceName == null) {
throw new RuntimeException(getClass() + " should either override getSupportedDeviceName or supports(GBDeviceCandidate)");
LOG.error(getClass() + " should either override getSupportedDeviceName or supports(GBDeviceCandidate)");
return false;
}
return supportedDeviceName.matcher(candidate.getName()).matches();

View File

@ -8,10 +8,16 @@ import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.unknown.UnknownDeviceSupport;
public class ScannableDeviceCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public boolean supports(GBDeviceCandidate candidate) {
return false;
}
@Override
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {