Explorar o código

meta: minor changes

Michele Caini %!s(int64=3) %!d(string=hai) anos
pai
achega
8c4803d906
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  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>
     [[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{};
     }
 };