check shareid before shareid[0]

This commit is contained in:
Alan Penner 2014-01-31 11:38:17 -08:00
parent 223b172cc6
commit 42d6c47edc
2 changed files with 9 additions and 10 deletions

View File

@ -125,7 +125,7 @@ class DB_Mysql():
shareid = self.dbc.fetchone()
if shareid[0] > 0:
if shareid and shareid[0] > 0:
# Note: difficulty = -1 here
self.execute(
"""

View File

@ -83,7 +83,7 @@ class DB_Mysql_Vardiff(DB_Mysql.DB_Mysql):
shareid = self.dbc.fetchone()
if shareid[0] > 0:
if shareid and shareid[0] > 0:
# Note: difficulty = -1 here
self.execute(
"""
@ -113,16 +113,15 @@ class DB_Mysql_Vardiff(DB_Mysql.DB_Mysql):
%(lres)s, %(result)s, %(reason)s, %(solution)s)
""",
{
"time": v[4],
"host": v[6],
"uname": v[0],
"lres": v[5],
"result": v[5],
"reason": v[9],
"solution": v[2]
"time": data[4],
"host": data[6],
"uname": data[0],
"lres": data[5],
"result": data[5],
"reason": data[9],
"solution": data[2]
}
)
self.dbh.commit()