Don't assign keys to an array index that doesn't exist yet

This commit is contained in:
jesopo 2019-11-08 17:05:09 +00:00
parent b4de61d009
commit b41588b098

View file

@ -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")