From be2c9dec94bfa28a17aa6b3529217fcb583569d8 Mon Sep 17 00:00:00 2001 From: Matthew Love Date: Tue, 20 May 2025 13:42:39 +0100 Subject: [PATCH] [4.3] Fix MSVC warning for potential mod by 0 (C4724) --- editor/plugins/gizmos/collision_polygon_3d_gizmo_plugin.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/plugins/gizmos/collision_polygon_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/collision_polygon_3d_gizmo_plugin.cpp index 44814fd2ba23..a7690a86022e 100644 --- a/editor/plugins/gizmos/collision_polygon_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/collision_polygon_3d_gizmo_plugin.cpp @@ -63,8 +63,10 @@ void CollisionPolygon3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { float depth = polygon->get_depth() * 0.5; Vector lines; - for (int i = 0; i < points.size(); i++) { - int n = (i + 1) % points.size(); + const int points_size = points.size(); + + for (int i = 0; i < points_size; i++) { + int n = (i + 1) % points_size; lines.push_back(Vector3(points[i].x, points[i].y, depth)); lines.push_back(Vector3(points[n].x, points[n].y, depth)); lines.push_back(Vector3(points[i].x, points[i].y, -depth));