aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2018-07-20 04:15:58 -0400
committerRapptz <[email protected]>2018-07-20 04:15:58 -0400
commit351bb1927a911476200ae1c28c9722020533d5ab (patch)
treeaec24e506d90c7767e95fb536d70930cf063ee15
parentRevert "Ensure gif avatar urls end in `.gif`" (diff)
downloaddiscord.py-351bb1927a911476200ae1c28c9722020533d5ab.tar.xz
discord.py-351bb1927a911476200ae1c28c9722020533d5ab.zip
Fix crashing with wonky TYPING_START events.
Fixes #1439
-rw-r--r--discord/state.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/discord/state.py b/discord/state.py
index df364296..22978e93 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -819,7 +819,7 @@ class ConnectionState:
user_id = utils._get_as_snowflake(data, 'user_id')
if isinstance(channel, DMChannel):
member = channel.recipient
- elif isinstance(channel, TextChannel):
+ elif isinstance(channel, TextChannel) and guild is not None:
member = guild.get_member(user_id)
elif isinstance(channel, GroupChannel):
member = utils.find(lambda x: x.id == user_id, channel.recipients)