diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2016-03-05 19:07:37 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2016-03-05 19:07:37 +0100 |
commit | 8ee1c56b827c37cebfc5e88062395ba838248ea9 (patch) | |
tree | d110667b5bd1e8498a4bcc90a15e409ebf3e4695 /wee_slack.py | |
parent | 5946a4a109dcc1474ab53ccc9e2025cb6ed88867 (diff) | |
download | wee-slack-8ee1c56b827c37cebfc5e88062395ba838248ea9.tar.gz |
Return from update_nicklist if no channel_buffer
All code paths in this method requires channel_buffer, so we can return
in the start if it is falsy.
This fixes a bug where the here and afk variables were not set, but used
later.
This fixes #150.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/wee_slack.py b/wee_slack.py index e3df8af..91cafda 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -422,17 +422,19 @@ class Channel(object): self.server.channels.update_hashtable() def update_nicklist(self, user=None): - if self.channel_buffer: - w.buffer_set(self.channel_buffer, "nicklist", "1") - - #create nicklists for the current channel if they don't exist - #if they do, use the existing pointer - here = w.nicklist_search_group(self.channel_buffer, '', NICK_GROUP_HERE) - if not here: - here = w.nicklist_add_group(self.channel_buffer, '', NICK_GROUP_HERE, "weechat.color.nicklist_group", 1) - afk = w.nicklist_search_group(self.channel_buffer, '', NICK_GROUP_AWAY) - if not afk: - afk = w.nicklist_add_group(self.channel_buffer, '', NICK_GROUP_AWAY, "weechat.color.nicklist_group", 1) + if not self.channel_buffer: + return + + w.buffer_set(self.channel_buffer, "nicklist", "1") + + #create nicklists for the current channel if they don't exist + #if they do, use the existing pointer + here = w.nicklist_search_group(self.channel_buffer, '', NICK_GROUP_HERE) + if not here: + here = w.nicklist_add_group(self.channel_buffer, '', NICK_GROUP_HERE, "weechat.color.nicklist_group", 1) + afk = w.nicklist_search_group(self.channel_buffer, '', NICK_GROUP_AWAY) + if not afk: + afk = w.nicklist_add_group(self.channel_buffer, '', NICK_GROUP_AWAY, "weechat.color.nicklist_group", 1) if user: user = self.members_table[user] |