Prevent NPE during Pod activation
This commit is contained in:
parent
52a01b0a81
commit
cab349dd0a
1 changed files with 6 additions and 3 deletions
|
@ -567,8 +567,11 @@ public abstract class PodStateManager {
|
||||||
podState.setTotalTicksDelivered(status.getTicksDelivered());
|
podState.setTotalTicksDelivered(status.getTicksDelivered());
|
||||||
podState.setPodProgressStatus(status.getPodProgressStatus());
|
podState.setPodProgressStatus(status.getPodProgressStatus());
|
||||||
podState.setTimeActive(status.getTimeActive());
|
podState.setTimeActive(status.getTimeActive());
|
||||||
|
|
||||||
|
boolean isBasalCertain = podState.isBasalCertain() == null || podState.isBasalCertain();
|
||||||
|
boolean isTempBasalCertain = podState.isTempBasalCertain() == null || podState.isTempBasalCertain();
|
||||||
if (!status.getDeliveryStatus().isTbrRunning()) {
|
if (!status.getDeliveryStatus().isTbrRunning()) {
|
||||||
if (podState.isTempBasalCertain()) {
|
if (isTempBasalCertain) {
|
||||||
clearTempBasal(); // Triggers onTbrChanged when appropriate
|
clearTempBasal(); // Triggers onTbrChanged when appropriate
|
||||||
} else {
|
} else {
|
||||||
// Don't trigger onTbrChanged as we will trigger onUncertainTbrRecovered below
|
// Don't trigger onTbrChanged as we will trigger onUncertainTbrRecovered below
|
||||||
|
@ -577,11 +580,11 @@ public abstract class PodStateManager {
|
||||||
podState.setTempBasalDuration(null);
|
podState.setTempBasalDuration(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!podState.isTempBasalCertain()) {
|
if (!isTempBasalCertain) {
|
||||||
podState.setTempBasalCertain(true);
|
podState.setTempBasalCertain(true);
|
||||||
onUncertainTbrRecovered();
|
onUncertainTbrRecovered();
|
||||||
}
|
}
|
||||||
if (!podState.isBasalCertain()) {
|
if (!isBasalCertain) {
|
||||||
podState.setBasalCertain(true);
|
podState.setBasalCertain(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue