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

View File

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