summaryrefslogtreecommitdiff
path: root/core/math/a_star.cpp
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2019-06-18 08:18:23 +0300
committerGitHub <noreply@github.com>2019-06-18 08:18:23 +0300
commit3caed76edaead682e247fa6927676223779f4c7c (patch)
tree1400ea0f4d210d6c50cf9b306fc6a06163d8f17a /core/math/a_star.cpp
parent0ac3687d6fe3bfa90f5cfbdf7c28752de1b627f0 (diff)
parentcc94a95fc9fe23a068da5cc8e3d345c450b502d5 (diff)
Merge pull request #29862 from Chaosus/fix_astar_crash
Fix AStar set/is_point_disabled crash
Diffstat (limited to 'core/math/a_star.cpp')
-rw-r--r--core/math/a_star.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 0b6e9ae929..359446dde6 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -435,10 +435,16 @@ PoolVector<int> AStar::get_id_path(int p_from_id, int p_to_id) {
}
void AStar::set_point_disabled(int p_id, bool p_disabled) {
+
+ ERR_FAIL_COND(!points.has(p_id));
+
points[p_id]->enabled = !p_disabled;
}
bool AStar::is_point_disabled(int p_id) const {
+
+ ERR_FAIL_COND_V(!points.has(p_id), false);
+
return !points[p_id]->enabled;
}