aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2015-10-21 14:34:49 +0200
committerTollef Fog Heen <tfheen@err.no>2015-10-21 14:34:49 +0200
commit4803b11769a6a6d35bb21e20b3a1cc5751c3bd4b (patch)
tree86a848bc5f1c5db82e73630a71759d59dd635637
parent03d7771396b61bb5b6c5b5a25c8876867570850e (diff)
downloadwee-slack-4803b11769a6a6d35bb21e20b3a1cc5751c3bd4b.tar.gz
Avoid backtrace if there are no muted channels
If there aren't any muted channels, we try to do ''.split(','), which returns [''], a list with a single item. Detect if we have empty items in the list and skip those.
-rw-r--r--wee_slack.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index e691a97..59a1cd5 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -288,6 +288,8 @@ class SlackServer(object):
name = self.users.find(item["user"]).name
self.add_channel(DmChannel(self, name, item["id"], item["is_open"], item["last_read"]))
for item in data['self']['prefs']['muted_channels'].split(','):
+ if item == '':
+ continue
self.channels.find(item).muted = True
for item in self.channels: