From 780f4901f4237fe2e5777e0c8e7b9b300d69d8d3 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Fri, 3 Nov 2017 22:03:40 +0100 Subject: [PATCH] Fail command if currentMenu becomes null. --- .../de/jotomo/ruffyscripter/RuffyScripter.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java index c217e0bf92..1e77ea8c34 100644 --- a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java +++ b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java @@ -486,17 +486,9 @@ public class RuffyScripter implements RuffyCommands { public Menu getCurrentMenu() { if (Thread.currentThread().isInterrupted()) throw new CommandException("Interrupted"); - long timeout = System.currentTimeMillis() + 5 * 1000; - // TODO this is probably due to a disconnect and rtDisconnect having nulled currentMenu. - // This here might just work, but needs a more controlled approach when implementing - // something to deal with connection loses - // TODO force reconnect? and retry? - while (currentMenu == null) { - if (System.currentTimeMillis() > timeout) { - throw new CommandException("Unable to read current menu"); - } - log.debug("currentMenu == null, waiting"); - waitForMenuUpdate(); + if (currentMenu == null) { + log.error("currentMenu == null, bailing"); + throw new CommandException("Unable to read current menu"); } return currentMenu; }