From a7447c0bef78665b3dd34485517c775b5f4fafb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eli=C3=A1n=20Hanisch?= Date: Thu, 1 Apr 2010 12:39:46 -0300 Subject: [PATCH] if not dabatase is set, db_run would return None and raise exception. fixed --- Bantracker/plugin.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Bantracker/plugin.py b/Bantracker/plugin.py index 0830003..9313b0f 100644 --- a/Bantracker/plugin.py +++ b/Bantracker/plugin.py @@ -424,7 +424,9 @@ class Bantracker(callbacks.Plugin): self.setRegistryValue('reviewTime', now) # update last time reviewed except Exception, e: # I need to catch exceptions as they are silenced - self.log.debug('Except: %s' %e) + import traceback + self.log.error('Except: %s' %e) + self.log.error(traceback.format_exc()) def _sendReviews(self, irc, msg): if msg.nick in self.pendingReviews: @@ -726,8 +728,10 @@ class Bantracker(callbacks.Plugin): return mutes + bans def get_banId(self, mask, channel): - data = self.db_run("SELECT MAX(id) FROM bans WHERE mask=%s AND channel=%s", (mask, channel), True)[0] - if not data[0]: + data = self.db_run("SELECT MAX(id) FROM bans WHERE mask=%s AND channel=%s", (mask, channel), True) + if data: + data = data[0] + if not data or not data[0]: return return int(data[0])