Fixed randomquote in the face of an empty database.

This commit is contained in:
Jeremy Fincher 2003-03-25 20:12:27 +00:00
parent 4b6f87f195
commit d3e28c1cfe

View File

@ -143,6 +143,9 @@ class Quotes(DBHandler, callbacks.Privmsg):
cursor.execute("""SELECT quote FROM quotes
ORDER BY random()
LIMIT 1""")
if cursor.rowcount != 1:
irc.error(msg, 'It seems that quote database is empty.')
return
quote = cursor.fetchone()[0]
irc.reply(msg, quote)
return