lib/rubocop/cop/rails/freeze_time.rb in rubocop-rails-2.16.1 vs lib/rubocop/cop/rails/freeze_time.rb in rubocop-rails-2.17.0
- old
+ new
@@ -41,10 +41,10 @@
def_node_matcher :zoned_time_now?, <<~PATTERN
(send (const nil? :Time) :zone)
PATTERN
def on_send(node)
- child_node, method_name, time_argument = *node.first_argument.children
+ child_node, method_name, time_argument = *node.first_argument&.children
return if time_argument || !child_node
return unless current_time?(child_node, method_name) || current_time_with_convert?(child_node, method_name)
add_offense(node) do |corrector|
last_argument = node.last_argument