diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2020-04-27 01:44:03 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2020-05-30 21:13:21 +0200 |
commit | 979db32b477a192cc150b2696167aa575fd99ff5 (patch) | |
tree | 645ccb7b9ae948d554c70b8c79d9bc0931da0b7d /wee_slack.py | |
parent | d69d9c54b8b9507fdf2566362021339a13479565 (diff) | |
download | wee-slack-979db32b477a192cc150b2696167aa575fd99ff5.tar.gz |
Check if channel_buffer exists in reprint_messages
After thread buffers are closed, the instances still remains in
channel.thread_channels, but channel_buffer is set to None.
reprint_messages may be called after this, e.g. on a reconnect.
Therefore, we have to check if channel_buffer is set before calling
buffer_clear.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py index 8898537..1b20e1a 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1544,9 +1544,10 @@ class SlackChannelCommon(object): no_log=no_log, extra_tags=extra_tags) def reprint_messages(self, history_message=False, no_log=True, force_render=False): - w.buffer_clear(self.channel_buffer) - for message in self.messages.values(): - self.prnt_message(message, history_message, no_log, force_render) + if self.channel_buffer: + w.buffer_clear(self.channel_buffer) + for message in self.messages.values(): + self.prnt_message(message, history_message, no_log, force_render) def send_add_reaction(self, msg_id, reaction): self.send_change_reaction("reactions.add", msg_id, reaction) |