SetTbrCommand: fix check in main menu after cancelling TBR.

The percentage attribute is displayed with a value of 100, though it's not visible on the display. This change just checks the no duration is displayed to verify no TBR is currently running.
This commit is contained in:
Johannes Mockenhaupt 2017-08-15 13:15:37 +02:00
parent e9672ff4aa
commit ec508b55c4
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -236,7 +236,7 @@ public class SetTbrCommand implements Command {
Object durationObj = scripter.currentMenu.getAttribute(MenuAttribute.RUNTIME);
if (percentage == 100) {
if (percentageObj != null || durationObj != null)
if (durationObj != null)
throw new CommandException().message("TBR cancelled, but main menu shows a running TBR");
return new CommandResult().success(true).enacted(true).message("TBR was cancelled");
@ -260,7 +260,7 @@ public class SetTbrCommand implements Command {
String.format(Locale.US, "TBR set to %d%% for %d min", percentage, duration));
} catch (Exception e) {
log.error("got exception: ", e);
return new CommandResult().success(false).message("failed to wait: " + e.getMessage());
return new CommandResult().success(false).message(e.getMessage()).exception(e);
}
}