diff options
Diffstat (limited to 'core/math/vector2.h')
-rw-r--r-- | core/math/vector2.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/math/vector2.h b/core/math/vector2.h index a2680b84fc..bd67299f33 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -31,6 +31,7 @@ #ifndef VECTOR2_H #define VECTOR2_H +#include "core/error/error_macros.h" #include "core/math/math_funcs.h" class String; @@ -60,9 +61,11 @@ struct _NO_DISCARD_ Vector2 { }; _FORCE_INLINE_ real_t &operator[](int p_idx) { + DEV_ASSERT((unsigned int)p_idx < 2); return coord[p_idx]; } _FORCE_INLINE_ const real_t &operator[](int p_idx) const { + DEV_ASSERT((unsigned int)p_idx < 2); return coord[p_idx]; } |