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

potential issue when field description is empty/null #66

Open
ka7 opened this issue May 3, 2017 · 1 comment
Open

potential issue when field description is empty/null #66

ka7 opened this issue May 3, 2017 · 1 comment
Assignees

Comments

@ka7
Copy link

ka7 commented May 3, 2017

when i upgraded my old version, the periodc-task dumped in cron-mode.

Cron-cmd: :

--- cd /opt/redmine/redmine-3.3.3; rake redmine:check_periodictasks RAILS_ENV=production

--- rake aborted!
TypeError: can't dup NilClass
/opt/redmine/redmine-3.3.3/plugins/periodictask/lib/scheduled_tasks_checker.rb:11:in dup' /opt/redmine/redmine-3.3.3/plugins/periodictask/lib/scheduled_tasks_checker.rb:11:in block in checktasks!'
/var/lib/gems/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/relation/delegation.rb:46:in each' /var/lib/gems/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/relation/delegation.rb:46:in each'
/opt/redmine/redmine-3.3.3/plugins/periodictask/lib/scheduled_tasks_checker.rb:4:in checktasks!' /opt/redmine/redmine-3.3.3/plugins/periodictask/lib/tasks/periodictask.rake:11:in block (2 levels) in <top (required)>'
/var/lib/gems/2.1.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => redmine:check_periodictasks
(See full trace by running task with --trace)

--- content of DB-table ---

--- MariaDB [redmine]> select description from periodictasks;
+-------------+
| description |
+-------------+
| | <- some space/blank
| NULL | <-some null
| NULL |
...

-- fixed with patch --
( now worksforme)
---a/lib/scheduled_tasks_checker.rb
+++ b/lib/scheduled_tasks_checker.rb
@@ -8,7 +8,8 @@ class ScheduledTasksChecker
# Copy subject and description and replace variables
subject = task.subject.dup
- description = task.description.dup
+ description = (task.description || "").dup
subject.gsub!('**DAY**', now.strftime("%d"))
subject.gsub!('**WEEK**', now.strftime("%W"))
subject.gsub!('**MONTH**', now.strftime("%m"))

@jperelli jperelli added the bug label Jun 20, 2017
@jperelli jperelli self-assigned this Jun 20, 2017
@jperelli
Copy link
Owner

I'll add the patch when I have some time. Thanks for the thorough report

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

No branches or pull requests

2 participants