From efcb097674b085aeabffa568780130c5ff2e6bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 30 Apr 2021 17:19:04 +0200 Subject: Prevent setting too big or too small Collision Mask and Layer --- scene/2d/ray_cast_2d.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scene/2d/ray_cast_2d.cpp') diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index 50625a0f39..f6740040c1 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -55,6 +55,7 @@ uint32_t RayCast2D::get_collision_mask() const { } void RayCast2D::set_collision_mask_bit(int p_bit, bool p_value) { + ERR_FAIL_INDEX_MSG(p_bit, 32, "Collision mask bit must be between 0 and 31 inclusive."); uint32_t mask = get_collision_mask(); if (p_value) { mask |= 1 << p_bit; @@ -65,6 +66,7 @@ void RayCast2D::set_collision_mask_bit(int p_bit, bool p_value) { } bool RayCast2D::get_collision_mask_bit(int p_bit) const { + ERR_FAIL_INDEX_V_MSG(p_bit, 32, false, "Collision mask bit must be between 0 and 31 inclusive."); return get_collision_mask() & (1 << p_bit); } -- cgit v1.2.3