aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_conversation.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-10-15 18:42:44 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commite66ff9e2e493b46457cc3d2794fcfaec457474d0 (patch)
tree5ceb5faa9501398702f90501812a317ec1232d3b /slack/slack_conversation.py
parenta395ba53ac7b6f6376ea8500902a8405d034874e (diff)
downloadwee-slack-e66ff9e2e493b46457cc3d2794fcfaec457474d0.tar.gz
Don't crash when message for hash is missing
We can have a hash for a message we don't have if e.g. a broadcast reply is sent, and the parent is older than the history we have fetched.
Diffstat (limited to 'slack/slack_conversation.py')
-rw-r--r--slack/slack_conversation.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py
index e71d8ad..f9c36d5 100644
--- a/slack/slack_conversation.py
+++ b/slack/slack_conversation.py
@@ -95,12 +95,13 @@ class SlackConversationMessageHashes(Dict[SlackTs, str]):
self._setitem(ts_with_same_hash, other_short_hash)
self._inverse_map[other_short_hash] = ts_with_same_hash
- other_message = self._conversation.messages[ts_with_same_hash]
- run_async(self._conversation.rerender_message(other_message))
- if other_message.thread_buffer is not None:
- run_async(other_message.thread_buffer.update_buffer_props())
- for reply in other_message.replies.values():
- run_async(self._conversation.rerender_message(reply))
+ other_message = self._conversation.messages.get(ts_with_same_hash)
+ if other_message:
+ run_async(self._conversation.rerender_message(other_message))
+ if other_message.thread_buffer is not None:
+ run_async(other_message.thread_buffer.update_buffer_props())
+ for reply in other_message.replies.values():
+ run_async(self._conversation.rerender_message(reply))
self._setitem(key, short_hash)
self._inverse_map[short_hash] = key