From ec508b55c4afaca26c5013b30feda0db2ee41c7b Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Tue, 15 Aug 2017 13:15:37 +0200 Subject: [PATCH] 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. --- .../java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java index 137a1a8196..8af26863f7 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java @@ -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); } }