From b1d5b12f55d2c99feb2a6c380ff5bad23cb97833 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 11 Aug 2016 22:52:26 +0200 Subject: [PATCH] fix npe --- .idea/misc.xml | 2 +- .../plugins/VirtualPump/VirtualPumpPlugin.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 5d19981032..fbb68289f4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/VirtualPump/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/VirtualPump/VirtualPumpPlugin.java index 35ed24d71f..805ddad431 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/VirtualPump/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/VirtualPump/VirtualPumpPlugin.java @@ -333,10 +333,11 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { try { battery.put("percent", batteryPercent); status.put("status", "normal"); - if (isTempBasalInProgress()) { - status.put("tempbasalpct", getTempBasal().percent); - status.put("tempbasalstart", DateUtil.toISOString(getTempBasal().timeStart)); - status.put("tempbasalremainmin", getTempBasal().getPlannedRemainingMinutes()); + TempBasal tb; + if ((tb = getTempBasal()) != null) { + status.put("tempbasalpct", tb.percent); + status.put("tempbasalstart", DateUtil.toISOString(tb.timeStart)); + status.put("tempbasalremainmin", tb.getPlannedRemainingMinutes()); } status.put("timestamp", DateUtil.toISOString(new Date()));