Skip to content

Commit

Permalink
Pathfinder: In error cases set minimal path length
Browse files Browse the repository at this point in the history
  • Loading branch information
zzam committed Feb 26, 2024
1 parent 6565d2d commit a214447
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/pathfinder/pathfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,15 @@ static int NewPath(PathFinderInput &input, PathFinderOutput &output)
// Update path if it was requested. Otherwise we may only want
// to know if there exists a path.
if (path != nullptr) {
output.Length = std::min<int>(i, PathFinderOutput::MAX_PATH_LENGTH);
output.OverflowLength = std::min<int>(i - output.Length, PathFinderOutput::MAX_OVERFLOW);
if (output.Length == 0) {
++output.Length;
if (i >= 0) {
output.Length = std::min<int>(i, PathFinderOutput::MAX_PATH_LENGTH);
output.OverflowLength = std::min<int>(i - output.Length, PathFinderOutput::MAX_OVERFLOW);
if (output.Length == 0) {
++output.Length;
}
} else {
output.Length = 0;
output.OverflowLength = 0;
}
}
return i;
Expand Down

0 comments on commit a214447

Please sign in to comment.