view: stable single type view ::contains function
This commit is contained in:
@@ -798,7 +798,7 @@ public:
|
||||
* @return True if the view contains the given entity, false otherwise.
|
||||
*/
|
||||
[[nodiscard]] bool contains(const entity_type entt) const noexcept {
|
||||
return view->contains(entt);
|
||||
return view && view->contains(entt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,6 +78,7 @@ TEST(SingleComponentView, InvalidView) {
|
||||
|
||||
ASSERT_EQ(view.size(), 0u);
|
||||
ASSERT_TRUE(view.empty());
|
||||
ASSERT_FALSE(view.contains(entt::null));
|
||||
|
||||
entt::storage<int> storage;
|
||||
view.storage(storage);
|
||||
|
||||
Reference in New Issue
Block a user