Skip to content

Commit baab51f

Browse files
authored
fix: avoid attaching smart action hooks on pre-defined smart actions (#526)
1 parent 4fbf749 commit baab51f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/forest_liana/bootstrapper.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ def generate_action_hooks()
5757
@collections_sent.each do |collection|
5858
collection['actions'].each do |action|
5959
c = get_collection(collection['name'])
60-
a = get_action(c, action['name'])
61-
load = !a.hooks.nil? && a.hooks.key?(:load) && a.hooks[:load].is_a?(Proc)
62-
change = !a.hooks.nil? && a.hooks.key?(:change) && a.hooks[:change].is_a?(Hash) ? a.hooks[:change].keys : []
63-
action['hooks'] = {'load' => load, 'change' => change}
60+
unless c.nil?
61+
a = get_action(c, action['name'])
62+
load = !a.hooks.nil? && a.hooks.key?(:load) && a.hooks[:load].is_a?(Proc)
63+
change = !a.hooks.nil? && a.hooks.key?(:change) && a.hooks[:change].is_a?(Hash) ? a.hooks[:change].keys : []
64+
action['hooks'] = {'load' => load, 'change' => change}
65+
end
6466
end
6567
end
6668
end

0 commit comments

Comments
 (0)