Merge #940 from tpikonen/fix-search+arrow-keys

Fix uncaught exception on channel list key navigation
This commit is contained in:
Eric Le Lay 2021-01-05 10:48:17 +01:00
commit 9faf7f21f0
1 changed files with 8 additions and 3 deletions

View File

@ -717,14 +717,19 @@ class gPodder(BuilderWidget, dbus.service.Object):
elif event.keyval in (Gdk.KEY_Up, Gdk.KEY_Down):
# If section markers exist in the treeview, we want to
# "jump over" them when moving the cursor up and down
selection = self.treeChannels.get_selection()
model, it = selection.get_selected()
if event.keyval == Gdk.KEY_Up:
step = -1
else:
step = 1
selection = self.treeChannels.get_selection()
model, it = selection.get_selected()
if it is None:
it = model.get_iter_first()
if it is None:
return False
step = 1
path = model.get_path(it)
while True:
path = (path[0] + step,)