aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2024-04-18 08:31:48 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-04-18 21:54:10 +0200
commit57da2d338a23cc0da4230896c9c69fa8494d757a (patch)
treea880c514517e37acfd2c52935a08cd2f3dfd825f
parent6b7c7ecc7cfd0ed97795cc1ea9568cc208c5c74e (diff)
downloadwee-slack-57da2d338a23cc0da4230896c9c69fa8494d757a.tar.gz
Check if nick is in _nicklist before removing it
If we get a channel_leave message from a user that hasn't spoken recently in the channel and hasn't been loaded in the nicklist (because the channel has too many members to load all of them into the nicklist), it isn't in _nicklist so trying to pop it from there would fail.
-rw-r--r--slack/slack_conversation.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py
index d43624b..e2e5599 100644
--- a/slack/slack_conversation.py
+++ b/slack/slack_conversation.py
@@ -579,8 +579,9 @@ class SlackConversation(SlackBuffer):
def nicklist_remove_nick(self, nick: Nick):
if self.type == "im" or self.buffer_pointer is None:
return
- nick_pointer = self._nicklist.pop(nick)
- weechat.nicklist_remove_nick(self.buffer_pointer, nick_pointer)
+ if nick in self._nicklist:
+ nick_pointer = self._nicklist.pop(nick)
+ weechat.nicklist_remove_nick(self.buffer_pointer, nick_pointer)
def display_thread_replies(self) -> bool:
if self.buffer_pointer is not None: