From f3be91aa1808cabd48af4bcd358196473c65ef4e Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Mon, 21 Dec 2020 21:39:15 +0100 Subject: [PATCH 1/2] Prevent crash in Omnipod driver --- .../androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fdbc32a199..ed3aa38a03 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 @@ -554,7 +554,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, if ("SMS".equals(reason)) { aapsLogger.info(LTag.PUMP, "Acknowledged AAPS getPumpStatus request it was requested through an SMS"); getPodStatus(); - } else if (!podStateManager.isBasalCertain() || !podStateManager.isTempBasalCertain()) { + } else if (podStateManager.isPodRunning() && (!podStateManager.isBasalCertain() || !podStateManager.isTempBasalCertain())) { aapsLogger.info(LTag.PUMP, "Acknowledged AAPS getPumpStatus request because basal and/or temp basal is uncertain"); getPodStatus(); } From 029a7e27fb32c27a05e63882a1a819bb9c29c87e Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Mon, 21 Dec 2020 22:26:41 +0100 Subject: [PATCH 2/2] Prevent crash on startup --- .../androidaps/plugins/general/overview/StatusLightHandler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt index 0c3bb72cb3..dbdfe39bb4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt @@ -52,7 +52,7 @@ class StatusLightHandler @Inject constructor( } if (!config.NSCLIENT) { - if (pump.model() == PumpType.Insulet_Omnipod) { + if (pump.model() == PumpType.Insulet_Omnipod && pump is OmnipodPumpPlugin) { // instanceof check is needed because at startup, pump can still be VirtualPumpPlugin and that will cause a crash because of the class cast below handleOmnipodBatteryLevel(careportal_batterylevel, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%", (pump as OmnipodPumpPlugin).isUseRileyLinkBatteryLevel) } else if (pump.model() != PumpType.AccuChekCombo) { handleLevel(careportal_batterylevel, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")