summaryrefslogtreecommitdiff
path: root/scene/resources/polygon_path_finder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/polygon_path_finder.cpp')
-rw-r--r--scene/resources/polygon_path_finder.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index 52fc21ac11..bd3236cb5b 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -466,11 +466,11 @@ Dictionary PolygonPathFinder::_get_data() const {
PoolVector<Vector2> p;
PoolVector<int> ind;
Array connections;
- p.resize(points.size() - 2);
- connections.resize(points.size() - 2);
+ p.resize(MAX(0, points.size() - 2));
+ connections.resize(MAX(0, points.size() - 2));
ind.resize(edges.size() * 2);
PoolVector<float> penalties;
- penalties.resize(points.size() - 2);
+ penalties.resize(MAX(0, points.size() - 2));
{
PoolVector<Vector2>::Write wp = p.write();
PoolVector<float>::Write pw = penalties.write();