Skip to content

Commit 38eacc3

Browse files
author
Pelle ten Cate
committed
Fix a bug in dirty_hash_to_rule
Make `dirty_hash_to_rule` capable of handling "null" as input, which is the default when 'No recurrence' is selected in the drop-down.
1 parent 9f7a83c commit 38eacc3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/recurring_select.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ def self.dirty_hash_to_rule(params)
77
if params.is_a? IceCube::Rule
88
params
99
else
10-
if params.is_a?(String)
11-
params = JSON.parse(params)
10+
params = JSON.parse(params, quirks_mode: true) if params.is_a?(String)
11+
if params.nil?
12+
nil
13+
else
14+
params = params.symbolize_keys
15+
rules_hash = filter_params(params)
16+
IceCube::Rule.from_hash(rules_hash)
1217
end
1318

14-
params = params.symbolize_keys
15-
rules_hash = filter_params(params)
16-
17-
IceCube::Rule.from_hash(rules_hash)
1819
end
1920
end
2021

0 commit comments

Comments
 (0)