From 85fe6ecc32ace7fcf119d9b492e37cd627ae7e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 28 Sep 2022 17:05:34 +0200 Subject: Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used --- servers/physics_3d/godot_space_3d.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'servers/physics_3d') diff --git a/servers/physics_3d/godot_space_3d.cpp b/servers/physics_3d/godot_space_3d.cpp index 76d59202c9..c23485279d 100644 --- a/servers/physics_3d/godot_space_3d.cpp +++ b/servers/physics_3d/godot_space_3d.cpp @@ -120,8 +120,8 @@ bool GodotPhysicsDirectSpaceState3D::intersect_ray(const RayParameters &p_parame bool collided = false; Vector3 res_point, res_normal; - int res_shape; - const GodotCollisionObject3D *res_obj; + int res_shape = -1; + const GodotCollisionObject3D *res_obj = nullptr; real_t min_d = 1e10; for (int i = 0; i < amount; i++) { @@ -185,6 +185,7 @@ bool GodotPhysicsDirectSpaceState3D::intersect_ray(const RayParameters &p_parame if (!collided) { return false; } + ERR_FAIL_NULL_V(res_obj, false); // Shouldn't happen but silences warning. r_result.collider_id = res_obj->get_instance_id(); if (r_result.collider_id.is_valid()) { -- cgit v1.2.3