diff --git a/libyul/Object.cpp b/libyul/Object.cpp index e357e1561..6c79d4367 100644 --- a/libyul/Object.cpp +++ b/libyul/Object.cpp @@ -197,12 +197,11 @@ std::shared_ptr Object::objectAt(std::shared_ptr const& _object, { std::shared_ptr object = nullptr; traverseObjectTree(_object.get(), YulString(_qualifiedName), [&](Object const* _obj) -> bool { - if (_qualifiedName.empty() || _qualifiedName == _obj->name.str()) - { - object = make_shared(*_obj); - return true; - } - return false; + if (!_qualifiedName.empty() && _qualifiedName != _obj->name.str()) + return false; + + object = make_shared(*_obj); + return true; }); return object;