Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in UselessSetterCall #485

Closed
jonas054 opened this issue Sep 14, 2013 · 1 comment · Fixed by #495
Closed

Crash in UselessSetterCall #485

jonas054 opened this issue Sep 14, 2013 · 1 comment · Fixed by #495

Comments

@jonas054
Copy link
Collaborator

This program causes an error in UselessSetterCall. It is very similar to an existing spec but has an or assignment. Perhaps you can look at it, @yujinakayama.

def test(some_arg)
  some_arg ||= Top.new
  some_arg.attr = 5
end

Stack trace:

     NoMethodError:
       undefined method `type' for nil:NilClass
     # ./lib/rubocop/cop/lint/useless_setter_call.rb:72:in `block in contains_object_passed_as_argument?'
     # ./lib/rubocop/cop/cop.rb:171:in `block (2 levels) in on_node'
@yujinakayama
Copy link
Collaborator

OK 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants