[gnome-music] view: make sure that path is valid in _on_item_activated when getting iter
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] view: make sure that path is valid in _on_item_activated when getting iter
- Date: Mon, 19 Jan 2015 11:15:25 +0000 (UTC)
commit 17f594a4b99bdbeb23ae8e95c7efc8020148d849
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Mon Jan 19 12:13:16 2015 +0100
view: make sure that path is valid in _on_item_activated when getting iter
https://bugzilla.gnome.org/show_bug.cgi?id=726459
gnomemusic/view.py | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index c3625ae..d08be62 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -308,7 +308,10 @@ class Albums(ViewContainer):
@log
def _on_item_activated(self, widget, id, path):
- _iter = self._model.get_iter(path)
+ try:
+ _iter = self._model.get_iter(path)
+ except TypeError:
+ return
title = self._model.get_value(_iter, 2)
artist = self._model.get_value(_iter, 3)
item = self._model.get_value(_iter, 5)
@@ -390,7 +393,10 @@ class Songs(ViewContainer):
@log
def _on_item_activated(self, widget, id, path):
- _iter = self._model.get_iter(path)
+ try:
+ _iter = self._model.get_iter(path)
+ except TypeError:
+ return
if self._model.get_value(_iter, 8) != self.errorIconName:
self.player.set_playlist('Songs', None, self._model, _iter, 5)
self.player.set_playing(True)
@@ -606,7 +612,10 @@ class Artists (ViewContainer):
@log
def _on_item_activated(self, widget, item_id, path):
- _iter = self._model.get_iter(path)
+ try:
+ _iter = self._model.get_iter(path)
+ except TypeError:
+ return
self._last_selection = _iter
artist = self._model.get_value(_iter, 2)
albums = self._artists[artist.casefold()]['albums']
@@ -950,7 +959,10 @@ class Playlist(ViewContainer):
@log
def _on_item_activated(self, widget, id, path):
- _iter = self._model.get_iter(path)
+ try:
+ _iter = self._model.get_iter(path)
+ except TypeError:
+ return
if self._model.get_value(_iter, 8) != self.errorIconName:
self.player.set_playlist(
'Playlist', self.current_playlist.get_id(),
@@ -1242,7 +1254,10 @@ class Search(ViewContainer):
@log
def _on_item_activated(self, widget, id, path):
- child_path = self.filter_model.convert_path_to_child_path(path)
+ try:
+ child_path = self.filter_model.convert_path_to_child_path(path)
+ except TypeError:
+ return
_iter = self._model.get_iter(child_path)
if self._model[_iter][11] == 'album':
title = self._model.get_value(_iter, 2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]