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_2d/godot_space_2d.cpp | |
parent | 14e1f36e614686f3fea0c74fac3624d1027dd5cc (diff) |
Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used
Diffstat (limited to 'servers/physics_2d/godot_space_2d.cpp')
-rw-r--r-- | servers/physics_2d/godot_space_2d.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/servers/physics_2d/godot_space_2d.cpp b/servers/physics_2d/godot_space_2d.cpp index afcc5af951..681f23f7bc 100644 --- a/servers/physics_2d/godot_space_2d.cpp +++ b/servers/physics_2d/godot_space_2d.cpp @@ -129,8 +129,8 @@ bool GodotPhysicsDirectSpaceState2D::intersect_ray(const RayParameters &p_parame bool collided = false; Vector2 res_point, res_normal; - int res_shape; - const GodotCollisionObject2D *res_obj; + int res_shape = -1; + const GodotCollisionObject2D *res_obj = nullptr; real_t min_d = 1e10; for (int i = 0; i < amount; i++) { @@ -190,6 +190,7 @@ bool GodotPhysicsDirectSpaceState2D::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()) { |