From 8df8c27a6605262f748455b9ee7e07cde81cdee0 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 11 Feb 2004 06:06:19 +0000 Subject: [PATCH] Safety catch for inconsistent wordstats/users databases. --- plugins/WordStats.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/WordStats.py b/plugins/WordStats.py index 0938c0538..8b038504d 100644 --- a/plugins/WordStats.py +++ b/plugins/WordStats.py @@ -250,7 +250,12 @@ class WordStats(callbacks.Privmsg): for (userid, count) in self.db.getTopUsers(channel, word, n): if userid == id: rank = None - username = ircdb.users.getUser(userid).name + try: + username = ircdb.users.getUser(userid).name + except KeyError: + irc.error('Odd, I have a user in my WordStats database ' + 'that doesn\'t exist in the user database.') + return L.append('%s: %s' % (username, count)) ret = 'Top %s (out of a total of %s seen):' % \ (utils.nItems(ers, len(L)), utils.nItems(repr(word), total))