Prevent NPE

This commit is contained in:
Bart Sopers 2020-08-08 18:44:33 +02:00
parent 3bc53544a2
commit 76d267dce4

View file

@ -42,7 +42,7 @@ public class InsertCannulaAction implements OmnipodAction<StatusResponse> {
@Override @Override
public StatusResponse execute(OmnipodCommunicationManager communicationService) { public StatusResponse execute(OmnipodCommunicationManager communicationService) {
if (podStateManager.getSetupProgress().isBefore(SetupProgress.PRIMING_FINISHED)) { if (!podStateManager.isPaired() || podStateManager.getSetupProgress().isBefore(SetupProgress.PRIMING_FINISHED)) {
throw new IllegalSetupProgressException(SetupProgress.PRIMING_FINISHED, podStateManager.getSetupProgress()); throw new IllegalSetupProgressException(SetupProgress.PRIMING_FINISHED, podStateManager.getSetupProgress());
} }