Browse Source

meta: minor changes

Michele Caini 3 years ago
parent
commit
8c4803d906
1 changed files with 5 additions and 4 deletions
  1. 5 4
      src/entt/meta/meta.hpp

+ 5 - 4
src/entt/meta/meta.hpp

@@ -700,12 +700,13 @@ struct meta_common {
 
 
     template<typename Type, auto Member, typename Node>
     template<typename Type, auto Member, typename Node>
     [[nodiscard]] auto find(const std::shared_ptr<Node> &node, const id_type key) const {
     [[nodiscard]] auto find(const std::shared_ptr<Node> &node, const id_type key) const {
-        if(!node) {
-            return Type{};
+        if(node) {
+            if(const auto it = ((*node).*Member).find(key); it != ((*node).*Member).cend()) {
+                return Type{it->second};
+            }
         }
         }
 
 
-        const auto it = ((*node).*Member).find(key);
-        return it != ((*node).*Member).cend() ? it->second : Type{};
+        return Type{};
     }
     }
 };
 };