Skip to content

Commit 07b0c5b

Browse files
author
Adam Robbins-Pianka
committed
BUG: Check that result is not None before indexing
Fix #1178
1 parent da407f6 commit 07b0c5b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

qiita_db/user.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,13 @@ def verify_code(cls, email, code, code_type):
272272
sql = ("SELECT {1} from qiita.{0} where email"
273273
" = %s".format(cls._table, column))
274274
conn_handler = SQLConnectionHandler()
275-
db_code = conn_handler.execute_fetchone(sql, (email,))[0]
275+
db_code = conn_handler.execute_fetchone(sql, (email,))
276+
277+
if db_code is None:
278+
return False
279+
else:
280+
db_code = db_code[0]
281+
276282
if db_code == code and code_type == "create":
277283
# verify the user
278284
level = conn_handler.execute_fetchone(

0 commit comments

Comments
 (0)