Skip to content

Commit

Permalink
fix: Aborted state is now correctly set back, after aborting
Browse files Browse the repository at this point in the history
  • Loading branch information
Metaphoriker committed Sep 22, 2024
1 parent 1c4a66c commit 0a7150e
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@ private PathfinderResult executePathing(
while (!nodeQueue.isEmpty()
&& depth.getDepth() <= pathfinderConfiguration.getMaxIterations()) {

if (isAborted()) {
return finishPathing(PathState.ABORTED, fallbackNode);
}
if (isAborted()) return abortedPathing(fallbackNode);

Node currentNode = nodeQueue.deleteMin().getValue();
fallbackNode = currentNode;
Expand All @@ -204,14 +202,19 @@ private PathfinderResult executePathing(
start, target, currentNode, depth, nodeQueue, examinedPositions, filters, filterStages);
}

aborted = false;
aborted = false; // just in case

return backupPathfindingOrFailure(depth, start, target, filters, fallbackNode);
} catch (Exception e) {
throw ErrorLogger.logFatalErrorWithStacktrace("Failed to find path", e);
}
}

private PathfinderResult abortedPathing(Node fallbackNode) {
aborted = false;
return finishPathing(PathState.ABORTED, fallbackNode);
}

private boolean isAborted() {
return aborted;
}
Expand Down

0 comments on commit 0a7150e

Please sign in to comment.