From a3cea32f93eb08205358a92d78f5edb77b5dccdf Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Tue, 30 Apr 2024 11:02:56 +0200 Subject: [PATCH] table: check pos when invoking operator[] --- src/entt/entity/table.hpp | 2 ++ 1 file changed, 2 insertions(+) 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]...); }