Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR fixes the following error for `Lint/UselessTimes` when using empty block argument. ```console % cat example.rb def foo 1.times do end end % rubocop --only Lint/UselessTimes -d (snip) Inspecting 1 file Scanning /Users/koic/src/github.com/koic/rubocop-issues/bar/example.rb An error occurred while Lint/UselessTimes cop was inspecting /Users/koic/src/github.com/koic/rubocop-issues/bar/example.rb:2:2. undefined method `source' for nil:NilClass /Users/koic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.91.0/ lib/rubocop/cop/lint/useless_times.rb:76:in `autocorrect_block' /Users/koic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.91.0/ lib/rubocop/cop/lint/useless_times.rb:57:in `block in on_send' /Users/koic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.91.0/ lib/rubocop/cop/base.rb:333:in `correct' /Users/koic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.91.0/ lib/rubocop/cop/base.rb:126:in `add_offense' /Users/koic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rubocop-0.91.0/ lib/rubocop/cop/lint/useless_times.rb:49:in `on_send' ```
- Loading branch information