From 2e22f1cf54a0dd022547bc0b9614dbc231c96fa1 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 1 Sep 2018 14:47:46 -0700 Subject: [PATCH] hopefully make currentlyRunning more resilient --- .../pathing/calc/AbstractNodeCostSearch.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index 2894b989..3960a376 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -81,9 +81,19 @@ public abstract class AbstractNodeCostSearch implements IPathFinder { throw new IllegalStateException("Path Finder is currently in use, and cannot be reused!"); } this.cancelRequested = false; - Optional path = calculate0(); - isFinished = true; - return path; + try { + Optional path = calculate0(); + isFinished = true; + return path; + } catch (Exception e) { + currentlyRunning = null; + isFinished = true; + if (e instanceof RuntimeException) { + throw (RuntimeException) e; + } else { + throw new RuntimeException(e); + } + } } protected abstract Optional calculate0();