diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-28 17:05:34 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-28 17:05:34 +0200 |
commit | 85fe6ecc32ace7fcf119d9b492e37cd627ae7e4d (patch) | |
tree | f6f386733d5ecc86364fffeef7402dc2af0227dd /servers/physics_3d | |
parent | 14e1f36e614686f3fea0c74fac3624d1027dd5cc (diff) |
Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used
Diffstat (limited to 'servers/physics_3d')
-rw-r--r-- | servers/physics_3d/godot_space_3d.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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()) { |