Quellcode durchsuchen

Merge pull request #47669 from madmiraal/fix-47438-3.x

[3.x] Ensure ConvexPolygonShape support count variable is initialised
Rémi Verschelde vor 4 Jahren
Ursprung
Commit
cd728abb98
1 geänderte Dateien mit 3 neuen und 0 gelöschten Zeilen
  1. 3 0
      servers/physics/shape_sw.cpp

+ 3 - 0
servers/physics/shape_sw.cpp

@@ -959,6 +959,9 @@ void ConvexPolygonShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vect
 	const Vector3 *vertices = mesh.vertices.ptr();
 	int vc = mesh.vertices.size();
 
+	r_amount = 0;
+	ERR_FAIL_COND_MSG(vc == 0, "Convex polygon shape has no vertices.");
+
 	//find vertex first
 	real_t max = 0;
 	int vtx = 0;