op14: verify the channel exists

This commit is contained in:
NotNite 2021-09-22 21:29:41 -04:00
parent 2ec293702f
commit 4f543442b9
No known key found for this signature in database
GPG Key ID: BD91A5402CCEB08A
1 changed files with 14 additions and 0 deletions

View File

@ -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(