From 6d3f0014c21e2b1d1e5685ad37b71dd76f39479d Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 21 Jul 2022 16:58:54 +0200 Subject: [PATCH] prevent NPE --- .../plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java index f4c1bb19c7..f1c8882213 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPlugin.java @@ -46,6 +46,7 @@ import info.nightscout.androidaps.interfaces.Pump; import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpPluginBase; import info.nightscout.androidaps.interfaces.PumpSync; +import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BasalSchedule; import info.nightscout.shared.logging.AAPSLogger; import info.nightscout.shared.logging.LTag; import info.nightscout.androidaps.plugins.bus.RxBus; @@ -628,8 +629,9 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley if (!podStateManager.isPodRunning()) { return 0.0d; } - - return podStateManager.getBasalSchedule().rateAt(TimeUtil.toDuration(DateTime.now())); + BasalSchedule schedule = podStateManager.getBasalSchedule(); + if (schedule != null) return schedule.rateAt(TimeUtil.toDuration(DateTime.now())); + else return 0; } @Override