summaryrefslogtreecommitdiffhomepage
path: root/src/world.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-04-08 18:05:23 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-04-08 18:05:23 +0200
commit9cca30206a8de348bde4bddfa8ae10bd35ea8b66 (patch)
treed20df7e01a4ca4ef26b5c6cfb369b0d96c0598ca /src/world.hpp
parent9d3d8c46af491b0aece27129f0a7ded247669960 (diff)
editor: fix inspector use after free
Diffstat (limited to 'src/world.hpp')
-rw-r--r--src/world.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/world.hpp b/src/world.hpp
index e6ec4f5b..8148bfd5 100644
--- a/src/world.hpp
+++ b/src/world.hpp
@@ -82,7 +82,7 @@ public:
return ret;
}
- template<typename T = entity> std::shared_ptr<T> find_entity(object_id id);
+ template<typename T = entity> std::shared_ptr<T> find_entity(object_id id);
bool is_teardown() const { return _teardown; }
object_id entity_counter() const { return _entity_counter; }
@@ -98,7 +98,7 @@ public:
template<typename T>
std::shared_ptr<T> world::find_entity(object_id id)
{
- static_assert(std::is_base_of_v<entity, T>);
+ static_assert(std::is_same_v<entity, T> || std::is_base_of_v<entity, T>);
// make it a dependent name so that including "src/entity.hpp" isn't needed
using U = std::conditional_t<std::is_same_v<T, entity>, T, entity>;
if (std::shared_ptr<U> ptr = find_entity_(id); !ptr)