diff --git a/src/entt/entity/table.hpp b/src/entt/entity/table.hpp index 2c104fbf8..6d97b552e 100644 --- a/src/entt/entity/table.hpp +++ b/src/entt/entity/table.hpp @@ -397,11 +397,13 @@ public: * @return The row data at specified location. */ [[nodiscard]] std::tuple operator[](const size_type pos) const { + ENTT_ASSERT(pos < size(), "Index out of bounds"); return std::forward_as_tuple(std::get>(payload.first())[pos]...); } /*! @copydoc operator[] */ [[nodiscard]] std::tuple operator[](const size_type pos) { + ENTT_ASSERT(pos < size(), "Index out of bounds"); return std::forward_as_tuple(std::get>(payload.first())[pos]...); }