From 38b01600aad3001ad548e221fe3af15d6bec8c00 Mon Sep 17 00:00:00 2001 From: Luna Mendes Date: Sun, 18 Nov 2018 18:33:35 -0300 Subject: [PATCH] pubsub.lazy_guild: handle unknown role on role_pos_update - pubsub.lazy_guild: handle item_index being None on resync_by_item --- litecord/pubsub/lazy_guild.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/litecord/pubsub/lazy_guild.py b/litecord/pubsub/lazy_guild.py index 375f93a..060d481 100644 --- a/litecord/pubsub/lazy_guild.py +++ b/litecord/pubsub/lazy_guild.py @@ -595,6 +595,9 @@ class GuildMemberList: async def resync_by_item(self, item_index: int): """Resync but only giving the item index.""" + if item_index is None: + return [] + return await self.resync( self.get_subs(item_index), item_index @@ -974,6 +977,11 @@ class GuildMemberList: role_id = int(role['id']) old_index = self.get_group_item_index(role_id) + + if not old_index: + log.warning('lazy role_pos_update: unknown group {}', role_id) + return + old_sessions = list(self.get_subs(old_index)) groups_idx = self._get_role_as_group_idx(role_id)