diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java index 7e91f86cbe..f2fa7909c7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/DanaRPlugin.java @@ -292,17 +292,19 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf @Override public double getTempBasalAbsoluteRate() { - if (isRealTempBasalInProgress()) { - if (getRealTempBasal().isAbsolute) { - return getRealTempBasal().absolute; + TempBasal tb = getRealTempBasal(); + if (tb != null) { + if (tb.isAbsolute) { + return tb.absolute; } else { Double baseRate = getBaseBasalRate(); - Double tempRate = baseRate * (getRealTempBasal().percent / 100d); + Double tempRate = baseRate * (tb.percent / 100d); return tempRate; } } - if (isExtendedBoluslInProgress() && useExtendedBoluses) { - return getBaseBasalRate() + getExtendedBolus().absolute; + TempBasal eb = getExtendedBolus(); + if (eb != null && useExtendedBoluses) { + return getBaseBasalRate() + eb.absolute; } return 0; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/DanaRKoreanPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/DanaRKoreanPlugin.java index c3784d80e4..1b3aced79e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/DanaRKoreanPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/DanaRKoreanPlugin.java @@ -292,17 +292,19 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints @Override public double getTempBasalAbsoluteRate() { - if (isRealTempBasalInProgress()) { - if (getRealTempBasal().isAbsolute) { - return getRealTempBasal().absolute; + TempBasal tb = getRealTempBasal(); + if (tb != null) { + if (tb.isAbsolute) { + return tb.absolute; } else { Double baseRate = getBaseBasalRate(); - Double tempRate = baseRate * (getRealTempBasal().percent / 100d); + Double tempRate = baseRate * (tb.percent / 100d); return tempRate; } } - if (isExtendedBoluslInProgress() && useExtendedBoluses) { - return getBaseBasalRate() + getExtendedBolus().absolute; + TempBasal eb = getExtendedBolus(); + if (eb != null && useExtendedBoluses) { + return getBaseBasalRate() + eb.absolute; } return 0; }