diff options
author | Rafał Mikrut <mikrutrafal@protonmail.com> | 2021-04-30 17:19:04 +0200 |
---|---|---|
committer | Rafał Mikrut <mikrutrafal@protonmail.com> | 2021-04-30 17:19:04 +0200 |
commit | efcb097674b085aeabffa568780130c5ff2e6bed (patch) | |
tree | c1dcb1d45856d96729e8f1d914c482bb8187de65 /scene/resources | |
parent | 66f696c2c16af1d88a016cc725fd10cac79bb838 (diff) |
Prevent setting too big or too small Collision Mask and Layer
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/navigation_mesh.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp index 8c12f59a00..0a25bb2ed1 100644 --- a/scene/resources/navigation_mesh.cpp +++ b/scene/resources/navigation_mesh.cpp @@ -92,6 +92,7 @@ uint32_t NavigationMesh::get_collision_mask() const { } void NavigationMesh::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; @@ -102,6 +103,7 @@ void NavigationMesh::set_collision_mask_bit(int p_bit, bool p_value) { } bool NavigationMesh::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); } |