Skip to content

Conversation

@tpikonen
Copy link
Contributor

Typing a long search term to the channel list search until there is no matching channels left, and then shortening the search term with backspace results in a channel treeview with episodes, but with nothing selected.

Using the arrow key navigation in this state (like pressing 2 times Up arrow) results in this uncaught exception:

ERROR: Uncaught exception: Traceback (most recent call last):
  File "/home/tpikonen/src/gpodder/git-gpodder/src/gpodder/gtkui/main.py", line 728, in on_key_press
    path = model.get_path(it)
TypeError: Argument 1 does not allow None as a value

This PR selects the first episode in the list, when keyboard-navigating in a treeview without selection.

After searching, the channel list treeview sometimes does not have a
selected item, leading to an invalid iterator when navigating the list
with arrow keys.

Select the first episode item in the TreeView model in this case.
@auouymous
Copy link
Member

I can confirm the problem and that this fixes it, thanks.

@auouymous
Copy link
Member

With or without this patch, pressing up or down when channel and episode lists are empty also throws this exception. The following two lines fixes it.

                 if it is None:
                     it = model.get_iter_first()
+                    if it is None:
+                        return False
                     step = 1

elelay added a commit that referenced this pull request Jan 5, 2021
Fix uncaught exception on channel list key navigation
@elelay elelay merged commit 0cd1d12 into gpodder:master Jan 5, 2021
@elelay
Copy link
Member

elelay commented Jan 5, 2021

Merged, thanks :-)

@tpikonen tpikonen deleted the fix-search+arrow-keys branch January 5, 2021 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants