Sitelet https://github.com/gpodder/gpodder/pull/940
Skip to content

Fix uncaught exception on channel list key navigation - #940

Merged
elelay merged 1 commit into
gpodder:masterfrom
tpikonen:fix-search+arrow-keys
Jan 5, 2021
Merged

elelay merged 1 commit into
gpodder:masterfrom
tpikonen:fix-search+arrow-keys

Conversation

@tpikonen

Copy link
Copy Markdown
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
Copy Markdown
Member

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

@auouymous

Copy link
Copy Markdown
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

elelay commented Jan 5, 2021

Copy link
Copy Markdown
Member

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