From 103333dee10bf3f160d9f7f6bb6f309507ff2a67 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Thu, 12 Nov 2020 20:29:52 +0100 Subject: [PATCH] Add extra check --- .../pump/omnipod/OmnipodPumpPlugin.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index 515744ed80..469578181c 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -247,19 +247,21 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, if (podStateManager.hasPodState()) { AlertSet activeAlerts = podStateManager.getActiveAlerts(); - if (aapsOmnipodManager.isAutomaticallyAcknowledgeAlertsEnabled() && activeAlerts.size() > 0 && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) { - String alerts = TextUtils.join(", ", aapsOmnipodUtil.getTranslatedActiveAlerts(podStateManager)); - getCommandQueue().customCommand(new CommandAcknowledgeAlerts(), new Callback() { - @Override public void run() { - if (result != null) { - aapsLogger.debug(LTag.PUMP, "Acknowledge alerts result: {} ({})", result.success, result.comment); - if (result.success) { - Notification notification = new Notification(Notification.OMNIPOD_POD_ALERTS, resourceHelper.gq(R.plurals.omnipod_pod_alerts, activeAlerts.size(), alerts), Notification.URGENT); - rxBus.send(new EventNewNotification(notification)); + if (activeAlerts != null) { + if (aapsOmnipodManager.isAutomaticallyAcknowledgeAlertsEnabled() && activeAlerts.size() > 0 && !getCommandQueue().isCustomCommandInQueue(CommandAcknowledgeAlerts.class)) { + String alerts = TextUtils.join(", ", aapsOmnipodUtil.getTranslatedActiveAlerts(podStateManager)); + getCommandQueue().customCommand(new CommandAcknowledgeAlerts(), new Callback() { + @Override public void run() { + if (result != null) { + aapsLogger.debug(LTag.PUMP, "Acknowledge alerts result: {} ({})", result.success, result.comment); + if (result.success) { + Notification notification = new Notification(Notification.OMNIPOD_POD_ALERTS, resourceHelper.gq(R.plurals.omnipod_pod_alerts, activeAlerts.size(), alerts), Notification.URGENT); + rxBus.send(new EventNewNotification(notification)); + } } } - } - }); + }); + } } }