summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-01-25 10:58:57 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-01-25 10:58:57 +0100
commit83cb9db81f9c0e1e76bf5608cd4a26e50a43a1fa (patch)
tree8374d28d4df897cf48ee6ae7df3ba8d7f82ce155 /src
parent776f0a7b894d99d2621b96de62e1f15e17d049a0 (diff)
a
Diffstat (limited to 'src')
-rw-r--r--src/dijkstra.cpp2
-rw-r--r--src/path-search-result.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/dijkstra.cpp b/src/dijkstra.cpp
index ef980ee6..69711453 100644
--- a/src/dijkstra.cpp
+++ b/src/dijkstra.cpp
@@ -108,7 +108,7 @@ void set_result_from_idx(path_search_result& result, const std::vector<visited>&
path.clear();
const auto& to_node = nodes[idx];
- if (to != to_node.pt)
+ if (result.is_found() && to != to_node.pt)
path.push_back(to);
result.set_cost(to_node.dist);
diff --git a/src/path-search-result.cpp b/src/path-search-result.cpp
index fe420475..50e9173a 100644
--- a/src/path-search-result.cpp
+++ b/src/path-search-result.cpp
@@ -34,7 +34,7 @@ path_search_result::path_search_result()
path_search_result::~path_search_result() noexcept
{
- if (_node) [[likely]]
+ if (_node && _node->vec.capacity() > 0) [[likely]]
{
_node->vec.clear();
_node->_next = std::move(_pool);