EROS: Test for null podState

This commit is contained in:
Milos Kozak 2022-03-28 14:00:32 +02:00
parent 1ff5afeaad
commit e3d7f6ea72

View file

@ -599,6 +599,8 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
@NonNull @NonNull
@Override @Override
public PumpEnactResult setNewBasalProfile(@NonNull Profile profile) { public PumpEnactResult setNewBasalProfile(@NonNull Profile profile) {
if (!podStateManager.hasPodState())
return new PumpEnactResult(getInjector()).enacted(false).success(false).comment("Null pod state");
PumpEnactResult result = executeCommand(OmnipodCommandType.SET_BASAL_PROFILE, () -> aapsOmnipodErosManager.setBasalProfile(profile, true)); PumpEnactResult result = executeCommand(OmnipodCommandType.SET_BASAL_PROFILE, () -> aapsOmnipodErosManager.setBasalProfile(profile, true));
aapsLogger.info(LTag.PUMP, "Basal Profile was set: " + result.getSuccess()); aapsLogger.info(LTag.PUMP, "Basal Profile was set: " + result.getSuccess());
@ -850,6 +852,8 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
@Override @Override
public PumpEnactResult executeCustomCommand(@NonNull CustomCommand command) { public PumpEnactResult executeCustomCommand(@NonNull CustomCommand command) {
if (!podStateManager.hasPodState())
return new PumpEnactResult(getInjector()).enacted(false).success(false).comment("Null pod state");
if (command instanceof CommandSilenceAlerts) { if (command instanceof CommandSilenceAlerts) {
return executeCommand(OmnipodCommandType.ACKNOWLEDGE_ALERTS, aapsOmnipodErosManager::acknowledgeAlerts); return executeCommand(OmnipodCommandType.ACKNOWLEDGE_ALERTS, aapsOmnipodErosManager::acknowledgeAlerts);
} }