Skip to content

Commit

Permalink
Handle None in replace_from_channel (bug 1291)
Browse files Browse the repository at this point in the history
If there is no active podcast at the moment, the
episode list should be an empty one.
  • Loading branch information
thp committed Mar 2, 2011
1 parent 472570b commit 5474a8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/gpodder/gtkui/frmntl/model.py
Expand Up @@ -405,7 +405,11 @@ def replace_from_channel(self, channel, downloading=None, \
self._all_episodes_view = getattr(channel, 'ALL_EPISODES_PROXY', False)

old_length = len(self._episodes)
self._episodes = channel.get_all_episodes()
# Avoid gPodder bug 1291
if channel is None:
self._episodes = []
else:
self._episodes = channel.get_all_episodes()
new_length = len(self._episodes)

for i in range(min(old_length, new_length)):
Expand Down
7 changes: 6 additions & 1 deletion src/gpodder/gtkui/model.py
Expand Up @@ -196,7 +196,12 @@ def replace_from_channel(self, channel, downloading=None, \

self._all_episodes_view = getattr(channel, 'ALL_EPISODES_PROXY', False)

episodes = channel.get_all_episodes()
# Avoid gPodder bug 1291
if channel is None:
episodes = []
else:
episodes = channel.get_all_episodes()

if not isinstance(episodes, list):
episodes = list(episodes)
count = len(episodes)
Expand Down

0 comments on commit 5474a8a

Please sign in to comment.