Handle nil resource args for some reason

- Ran this against `signal-cli` and despite it having a valid-looking resource block, it failed on `undefined method 'str_content' for nil:NilClass`.
This commit is contained in:
Issy Long 2024-02-20 23:48:58 +00:00
parent 5c7be57531
commit 3bfe7e5aa1
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -19,7 +19,7 @@ module RuboCop
return if resource_nodes.empty?
%w[lxml pyyaml].each do |resource_name|
found = resource_nodes.find { |node| node.arguments.first.str_content == resource_name }
found = resource_nodes.find { |node| node.arguments&.first&.str_content == resource_name }
next unless found
uses_from_macos_nodes = find_every_method_call_by_name(body_node, :uses_from_macos)