From d3e28c1cfe0daa91de5026e2704023e6df722e45 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 25 Mar 2003 20:12:27 +0000 Subject: [PATCH] Fixed randomquote in the face of an empty database. --- plugins/Quotes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/Quotes.py b/plugins/Quotes.py index 49aeefe68..90a6e8e30 100644 --- a/plugins/Quotes.py +++ b/plugins/Quotes.py @@ -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