Added handling for case of a channel with no pairs/follows.

This commit is contained in:
Jeremy Fincher 2003-04-20 07:15:31 +00:00
parent 29efc019df
commit 11a674eb2b
1 changed files with 3 additions and 0 deletions

View File

@ -131,6 +131,9 @@ class Markov(callbacks.Privmsg, ChannelDBHandler):
WHERE is_first=1
ORDER BY random()
LIMIT 1""")
if cursor.rowcount == 0:
irc.error(msg, 'I have no records for that channel.')
return
(id, first, second) = cursor.fetchone()
id = int(id)
words.append(first)