From 6f094856e76c5bd137f2b5286f9f6290ab0307d6 Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Tue, 9 Jan 2024 11:37:49 +0800 Subject: [PATCH] Make get_id_path return empty when first point is disabled --- core/math/a_star.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 80322432bd..1161a4732d 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -481,6 +481,10 @@ Vector AStar3D::get_id_path(int64_t p_from_id, int64_t p_to_id, bool p_ return ret; } + if (!a->enabled) { + return Vector(); + } + Point *begin_point = a; Point *end_point = b; @@ -764,6 +768,10 @@ Vector AStar2D::get_id_path(int64_t p_from_id, int64_t p_to_id, bool p_ return ret; } + if (!a->enabled) { + return Vector(); + } + AStar3D::Point *begin_point = a; AStar3D::Point *end_point = b;