[gnome-music/gnome-3-14] view: make sure that path is valid in _on_item_activated when getting iter



commit b763cb4a9add7b5636b64095a974a62a03e2eb11
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 026b8bd..f30d5b7 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -369,7 +369,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)
@@ -454,7 +457,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)
@@ -664,7 +670,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']
@@ -999,7 +1008,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(),
@@ -1235,7 +1247,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]