1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 01:09:47 +01:00

DeviceCommunicationService: catch uncaught exceptions from handleActions

Exceptions raised while handling actions in the device's support class
may result in the DeviceCommunicationService crashing as a whole and not
being started again until the user forces GB to make a connection by
pressing the device from the list.

This change is made, because Xiaomi devices make use of proto2 messages,
where optional fields cannot be set to null values as that will make it
throw NPEs.
This commit is contained in:
MrYoranimo 2023-12-05 20:13:13 +01:00
parent 7f7834c620
commit 561dc16b28

View File

@ -689,6 +689,8 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
handleAction(intent, action, device1);
} catch (DeviceNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
LOG.error("An exception was raised while handling the action {} for the device {}: ", action, device1, e);
}
}
break;