From 6b662ebdb9a6e6dd08a1df46e2f2eb2c525b30bd Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 22 Dec 2021 17:18:37 -0600 Subject: Cleanup: Return early --- .../geometry/nodes/node_geo_attribute_statistic.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc index e4f2e8ef7f4..4d6fb328ad9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_statistic.cc @@ -136,16 +136,18 @@ static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms) search_link_ops_for_declarations(params, declaration.inputs().take_front(2)); const std::optional type = node_type_from_other_socket(params.other_socket()); + if (!type) { + return; + } + if (params.in_out() == SOCK_IN) { - if (type) { - params.add_item(IFACE_("Attribute"), [node_type, type](LinkSearchOpParams ¶ms) { - bNode &node = params.add_node(node_type); - node.custom1 = *type; - params.update_and_connect_available_socket(node, "Attribute"); - }); - } + params.add_item(IFACE_("Attribute"), [node_type, type](LinkSearchOpParams ¶ms) { + bNode &node = params.add_node(node_type); + node.custom1 = *type; + params.update_and_connect_available_socket(node, "Attribute"); + }); } - else if (type) { + else { for (const SocketDeclarationPtr &socket_decl : declaration.outputs()) { StringRefNull name = socket_decl->name(); params.add_item(IFACE_(name.c_str()), [node_type, name, type](LinkSearchOpParams ¶ms) { -- cgit v1.2.3