From 7d9f8f8d7ff54e7bd6e63559afa8d65d9acb8556 Mon Sep 17 00:00:00 2001 From: Anna Date: Tue, 20 Apr 2010 15:43:06 -0400 Subject: [PATCH] Handle some edge cases elegantly --- twitterwidgets.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/twitterwidgets.py b/twitterwidgets.py index da849dc..2077dd8 100644 --- a/twitterwidgets.py +++ b/twitterwidgets.py @@ -75,7 +75,10 @@ class TweetPane(gtk.ScrolledWindow): # If this is our first load of this list, don't treat anything as new! if self.last_tweet_read is None: - self.last_tweet_read = statuses[0].id + try: + self.last_tweet_read = statuses[0].id + except IndexError: + self.last_tweet_read = 0 # Keep count of the new tweets for posting a status message self.num_new_tweets = 0 @@ -90,7 +93,10 @@ class TweetPane(gtk.ScrolledWindow): else: self.tweets[i].clear_status() - self.latest_tweet = statuses[0].id + try: + self.latest_tweet = statuses[0].id + except IndexError: + self.latest_tweet = 0 self.update_tab_label()