Fix crashing with wonky TYPING_START events.

Fixes #1439
This commit is contained in:
Rapptz 2018-07-20 04:15:58 -04:00
parent 2c7a855e11
commit 351bb1927a

View File

@ -819,7 +819,7 @@ class ConnectionState:
user_id = utils._get_as_snowflake(data, 'user_id') user_id = utils._get_as_snowflake(data, 'user_id')
if isinstance(channel, DMChannel): if isinstance(channel, DMChannel):
member = channel.recipient member = channel.recipient
elif isinstance(channel, TextChannel): elif isinstance(channel, TextChannel) and guild is not None:
member = guild.get_member(user_id) member = guild.get_member(user_id)
elif isinstance(channel, GroupChannel): elif isinstance(channel, GroupChannel):
member = utils.find(lambda x: x.id == user_id, channel.recipients) member = utils.find(lambda x: x.id == user_id, channel.recipients)