Prevent NPE during Pod activation

This commit is contained in:
Bart Sopers 2020-11-20 22:16:15 +01:00
parent 52a01b0a81
commit cab349dd0a

View file

@ -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);
} }