fix nullpointerexception in reading temp basal status
This commit is contained in:
parent
a39416d876
commit
806cc4a3a7
|
@ -292,17 +292,19 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getTempBasalAbsoluteRate() {
|
public double getTempBasalAbsoluteRate() {
|
||||||
if (isRealTempBasalInProgress()) {
|
TempBasal tb = getRealTempBasal();
|
||||||
if (getRealTempBasal().isAbsolute) {
|
if (tb != null) {
|
||||||
return getRealTempBasal().absolute;
|
if (tb.isAbsolute) {
|
||||||
|
return tb.absolute;
|
||||||
} else {
|
} else {
|
||||||
Double baseRate = getBaseBasalRate();
|
Double baseRate = getBaseBasalRate();
|
||||||
Double tempRate = baseRate * (getRealTempBasal().percent / 100d);
|
Double tempRate = baseRate * (tb.percent / 100d);
|
||||||
return tempRate;
|
return tempRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isExtendedBoluslInProgress() && useExtendedBoluses) {
|
TempBasal eb = getExtendedBolus();
|
||||||
return getBaseBasalRate() + getExtendedBolus().absolute;
|
if (eb != null && useExtendedBoluses) {
|
||||||
|
return getBaseBasalRate() + eb.absolute;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,17 +292,19 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getTempBasalAbsoluteRate() {
|
public double getTempBasalAbsoluteRate() {
|
||||||
if (isRealTempBasalInProgress()) {
|
TempBasal tb = getRealTempBasal();
|
||||||
if (getRealTempBasal().isAbsolute) {
|
if (tb != null) {
|
||||||
return getRealTempBasal().absolute;
|
if (tb.isAbsolute) {
|
||||||
|
return tb.absolute;
|
||||||
} else {
|
} else {
|
||||||
Double baseRate = getBaseBasalRate();
|
Double baseRate = getBaseBasalRate();
|
||||||
Double tempRate = baseRate * (getRealTempBasal().percent / 100d);
|
Double tempRate = baseRate * (tb.percent / 100d);
|
||||||
return tempRate;
|
return tempRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isExtendedBoluslInProgress() && useExtendedBoluses) {
|
TempBasal eb = getExtendedBolus();
|
||||||
return getBaseBasalRate() + getExtendedBolus().absolute;
|
if (eb != null && useExtendedBoluses) {
|
||||||
|
return getBaseBasalRate() + eb.absolute;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue