Fix limit case for non existant neighbors

remotes/origin/enhancement/email-actions
Alejandro Alonso 2014-11-17 13:52:52 +01:00
parent c844e59540
commit c34ec5b50c
1 changed files with 3 additions and 0 deletions

View File

@ -53,6 +53,9 @@ def get_neighbors(obj, results_set=None):
cursor = connection.cursor() cursor = connection.cursor()
cursor.execute(query, params) cursor.execute(query, params)
row = cursor.fetchone() row = cursor.fetchone()
if row is None:
return Neighbor(None, None)
obj_position = row[1] - 1 obj_position = row[1] - 1
try: try: