Fix another crash on prev/next change

If the currently displayed change was opened via a link and there
is a change list in the navigation hierarchy, Gertty will find
the change list but not the current change.  Protect against a
crash in that case and do nothing.

Change-Id: I85b00b8cf6af258b672f15352b75803d931c59a6
This commit is contained in:
James E. Blair 2014-09-05 13:56:53 -07:00
parent 954ca7dfb0
commit 4bfa1c4c03
1 changed files with 8 additions and 2 deletions

View File

@ -148,7 +148,10 @@ class ChangeListView(urwid.WidgetWrap):
def getNextChangeKey(self, change_key):
row = self.change_rows.get(change_key)
i = self.listbox.body.index(row)
try:
i = self.listbox.body.index(row)
except ValueError:
return None
if i+1 >= len(self.listbox.body):
return None
row = self.listbox.body[i+1]
@ -156,7 +159,10 @@ class ChangeListView(urwid.WidgetWrap):
def getPrevChangeKey(self, change_key):
row = self.change_rows.get(change_key)
i = self.listbox.body.index(row)
try:
i = self.listbox.body.index(row)
except ValueError:
return None
if i <= 0:
return None
row = self.listbox.body[i-1]