sciyoshi / redmine-slack

Slack notification plugin for Redmine
MIT License
404 stars 219 forks source link

NoMethodError in some instances #113

Open kostajh opened 7 years ago

kostajh commented 7 years ago

This error is occurring for me on some issues in some projects, even though the Slack channel is correctly configured:

app_1        | Completed 500 Internal Server Error in 5880ms (ActiveRecord: 129.7ms)
app_1        |
app_1        | NoMethodError (undefined method `split' for nil:NilClass):
app_1        |   plugins/redmine_slack/lib/redmine_slack/listener.rb:216:in `channels_for_project'
app_1        |   plugins/redmine_slack/lib/redmine_slack/listener.rb:208:in `channels_for_project'
app_1        |   plugins/redmine_slack/lib/redmine_slack/listener.rb:7:in `controller_issues_new_after_save'
app_1        |   lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'
app_1        |   lib/redmine/hook.rb:61:in `each'
app_1        |   lib/redmine/hook.rb:61:in `block in call_hook'
app_1        |   lib/redmine/hook.rb:58:in `tap'
app_1        |   lib/redmine/hook.rb:58:in `call_hook'
app_1        |   lib/redmine/hook.rb:91:in `call_hook'
app_1        |   app/controllers/issues_controller.rb:141:in `create'
app_1        |   lib/redmine/sudo_mode.rb:63:in `sudo_mode'
app_1        |
screen shot 2017-03-19 at 8 48 22 pm

My hacky solution is to check if val is set before proceeding, but maybe I'm missing something.

kostajh commented 7 years ago

I think I found this happens when (1) parent project doesn't have a Slack identifier set but (2) child project does.