From b41588b0981f6926fdb619fbf0319dbeab746615 Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 8 Nov 2019 17:05:09 +0000 Subject: [PATCH] Don't assign `keys` to an array index that doesn't exist yet --- modules/channel_keys.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/channel_keys.py b/modules/channel_keys.py index 5380e6db..01e3c38f 100644 --- a/modules/channel_keys.py +++ b/modules/channel_keys.py @@ -15,7 +15,13 @@ class Module(ModuleManager.BaseModule): def preprocess_send_join(self, event): if event["line"].args: channels = event["line"].args[0].split(",") - keys = event["line"].args[1:] + + init_keys = False + if len(event["line"].args) > 1: + init_keys = True + keys = event["line"].args[1].split(",") + else: + keys = [] with_keys = {} for channel in channels: @@ -33,7 +39,10 @@ class Module(ModuleManager.BaseModule): channels_out.append(channel_name) if key: keys_out.append(key) + event["line"].args[0] = ",".join(channels_out) + if not init_keys: + event["line"].args.append(None) event["line"].args[1] = ",".join(keys_out) @utils.hook("received.324")