mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-14 11:47:32 +01:00
Garmin: Fix NPE on call with privacy mode on
This commit is contained in:
parent
3a778a9f2a
commit
2212b244e6
@ -76,8 +76,9 @@ public class NotificationsHandler implements MessageHandler {
|
|||||||
public NotificationUpdateMessage onSetCallState(CallSpec callSpec) {
|
public NotificationUpdateMessage onSetCallState(CallSpec callSpec) {
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return null;
|
return null;
|
||||||
|
final int id = StringUtils.firstNonBlank(callSpec.number, "Gadgetbridge Call").hashCode();
|
||||||
if (callSpec.command == CallSpec.CALL_INCOMING) {
|
if (callSpec.command == CallSpec.CALL_INCOMING) {
|
||||||
NotificationSpec callNotificationSpec = new NotificationSpec(callSpec.number.hashCode());
|
NotificationSpec callNotificationSpec = new NotificationSpec(id);
|
||||||
callNotificationSpec.phoneNumber = callSpec.number;
|
callNotificationSpec.phoneNumber = callSpec.number;
|
||||||
callNotificationSpec.sourceAppId = callSpec.sourceAppId;
|
callNotificationSpec.sourceAppId = callSpec.sourceAppId;
|
||||||
callNotificationSpec.title = StringUtils.isEmpty(callSpec.name) ? callSpec.number : callSpec.name;
|
callNotificationSpec.title = StringUtils.isEmpty(callSpec.name) ? callSpec.number : callSpec.name;
|
||||||
@ -91,10 +92,8 @@ public class NotificationsHandler implements MessageHandler {
|
|||||||
|
|
||||||
return onNotification(callNotificationSpec);
|
return onNotification(callNotificationSpec);
|
||||||
} else {
|
} else {
|
||||||
if (callSpec.number != null) // this happens in debug screen
|
return onDeleteNotification(id);
|
||||||
return onDeleteNotification(callSpec.number.hashCode());
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationUpdateMessage onNotification(NotificationSpec notificationSpec) {
|
public NotificationUpdateMessage onNotification(NotificationSpec notificationSpec) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user