BolusCommand: cancel earlier if requested.

This commit is contained in:
Johannes Mockenhaupt 2017-10-31 02:13:13 +01:00
parent 50cbcaba52
commit 39b89df484
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -55,6 +55,11 @@ public class BolusCommand extends BaseCommand {
@Override
public void execute() {
try {
if (cancelRequested) {
bolusProgressReporter.report(STOPPED, 0, 0);
result.success = true;
return;
}
bolusProgressReporter.report(PROGRAMMING, 0, 0);
enterBolusMenu();
inputBolusAmount();
@ -191,6 +196,7 @@ public class BolusCommand extends BaseCommand {
}
public void requestCancellation() {
log.debug("Bolus cancellation requested");
cancelRequested = true;
bolusProgressReporter.report(STOPPING, 0, 0);
}