From 34bac05ccc6c11ea370aa14431e4d6d6cd28f1d6 Mon Sep 17 00:00:00 2001 From: Manuel Ignacio Pérez Alcolea Date: Mon, 9 Dec 2019 02:37:30 -0300 Subject: Ensure hidden_channels and bypass_roles use a list when not passed. The in_channel decorator raised 'NoneType' is not iterable when it wasn't passed, due to the default value being None but not checked against before iterating over it. This edit ensures the arguments are set to an empty list in cases where they have a value of None instead. --- bot/decorators.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bot/decorators.py b/bot/decorators.py index 61587f406..2d18eaa6a 100644 --- a/bot/decorators.py +++ b/bot/decorators.py @@ -38,6 +38,9 @@ def in_channel( Hidden channels are channels which will not be displayed in the InChannelCheckFailure error message. """ + hidden_channels = hidden_channels or [] + bypass_roles = bypass_roles or [] + def predicate(ctx: Context) -> bool: """In-channel checker predicate.""" if ctx.channel.id in channels or ctx.channel.id in hidden_channels: -- cgit v1.2.3