hopefully make currentlyRunning more resilient

This commit is contained in:
Leijurv 2018-09-01 14:47:46 -07:00
parent e705f9808b
commit 2e22f1cf54
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
1 changed files with 13 additions and 3 deletions

View File

@ -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<IPath> path = calculate0();
isFinished = true;
return path;
try {
Optional<IPath> 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<IPath> calculate0();