Browse Source

Geometry2D::make_atlas Fail is passed invalid rect size

(cherry picked from commit 988f4cdc90f9e6bf2ea960aa48e6b6e7e8faa7ee)
kleonc 4 years ago
parent
commit
5d628535b9
1 changed files with 4 additions and 0 deletions
  1. 4 0
      core/math/geometry.cpp

+ 4 - 0
core/math/geometry.cpp

@@ -992,6 +992,10 @@ void Geometry::make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_resu
 	// 256x8192 atlas (won't work anywhere).
 
 	ERR_FAIL_COND(p_rects.size() == 0);
+	for (int i = 0; i < p_rects.size(); i++) {
+		ERR_FAIL_COND(p_rects[i].width <= 0);
+		ERR_FAIL_COND(p_rects[i].height <= 0);
+	}
 
 	Vector<_AtlasWorkRect> wrects;
 	wrects.resize(p_rects.size());