fanzai0403 / status_button

redmine plugin status_button
21 stars 36 forks source link

Fix NoMethodError on creating issue via API #7

Closed wtetsu closed 6 years ago

wtetsu commented 7 years ago

NoMethodError always occurs when an issue is created via POST API.

Started POST "/redmine/projects/test/issues.json" for xxxx::xxxx:xxxx:xxxx:xxxx at 2017-08-25 11:21:33 +0900 Processing by IssuesController#create as JSON
  Parameters: {"issue"=>{"description"=>"bbb", "subject"=>"aaa"}, "project_id"=>"test"}
  Current user: xxxxxxxx (id=17)
Completed 500 Internal Server Error in 16ms (ActiveRecord: 0.0ms)

NoMethodError (undefined method `empty?' for nil:NilClass):
  plugins/status_button/lib/issues_status_hook.rb:20:in `block in update_issues'
  plugins/status_button/lib/issues_status_hook.rb:17:in `update_issues'
  plugins/status_button/lib/issues_status_hook.rb:4:in `controller_issues_new_before_save'
  lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'
  lib/redmine/hook.rb:61:in `each'
  lib/redmine/hook.rb:61:in `block in call_hook'
  lib/redmine/hook.rb:58:in `tap'
  lib/redmine/hook.rb:58:in `call_hook'
  lib/redmine/hook.rb:91:in `call_hook'
  app/controllers/issues_controller.rb:143:in `create'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Environment:

  Redmine version                3.3.3.stable
  Ruby version                   2.1.9-p490 (2016-03-30) [i386-mingw32]
  Rails version                  4.2.7.1
  Environment                    production
  Database adapter               Mysql2