lib/rubocop/cop/lint/ambiguous_operator.rb in rubocop-0.83.0 vs lib/rubocop/cop/lint/ambiguous_operator.rb in rubocop-0.84.0
- old
+ new
@@ -58,11 +58,13 @@
offense_node = offense_node(node)
return offense_node if offense_node
end
ast.each_node(:send).find do |send_node|
- offense_position?(send_node.first_argument, diagnostic) &&
- unary_operator?(send_node.first_argument, diagnostic)
+ first_argument = send_node.first_argument
+
+ first_argument &&
+ offense_position?(first_argument, diagnostic) && unary_operator?(first_argument, diagnostic)
end
end
def alternative_message(diagnostic)
operator = diagnostic.location.source