Skip to content

Commit c8ed88b

Browse files
petertsengdominikh
authored andcommitted
Don't remove plugin hooks accidentally
Under certain code paths, using select! instead of select would lead to modifying the plugin's hooks, instead of just a local copy. This effectively broke hooks when using more than one event type. Fixes cinchrbgh-207
1 parent b310ede commit c8ed88b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/cinch/plugin.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def __hooks(type = nil, events = nil, group = nil)
310310
if hooks.is_a?(Hash)
311311
hooks = hooks.map { |k, v| v }
312312
end
313-
hooks.select! { |hook| (events & hook.for).size > 0 }
313+
hooks = hooks.select { |hook| (events & hook.for).size > 0 }
314314
end
315315

316316
return hooks.select { |hook| hook.group.nil? || hook.group == group }

0 commit comments

Comments
 (0)