From 4f543442b97d18be30fd15b6a8da0c100ac34871 Mon Sep 17 00:00:00 2001 From: NotNite Date: Wed, 22 Sep 2021 21:29:41 -0400 Subject: [PATCH] op14: verify the channel exists --- litecord/gateway/websocket.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/litecord/gateway/websocket.py b/litecord/gateway/websocket.py index bf57fe8..c306591 100644 --- a/litecord/gateway/websocket.py +++ b/litecord/gateway/websocket.py @@ -1224,6 +1224,20 @@ class GatewayWebsocket: # make shard query for chan_id, ranges in data.get("channels", {}).items(): chan_id = int(chan_id) + + # we need to check if the channel exists + # or else bad things can happen + chan_type = await app.db.fetchval( + """ + SELECT channel_type + FROM channels + WHERE id = $1 + """, + chan_id, + ) + if chan_type is None: + continue + member_list = await app.lazy_guild.get_gml(chan_id) perms = await get_permissions(