[gnome-music/gnome-3-12] window: properly trap tracker's GError



commit 90cdc8457efd1cec1d47af4df6ccc62fb14fc567
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Mon Jan 19 12:18:42 2015 +0100

    window: properly trap tracker's GError
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733686

 gnomemusic/window.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 6e84019..caa7e28 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -199,15 +199,16 @@ class Window(Gtk.ApplicationWindow):
         self._box.pack_start(self.player.eventBox, False, False, 0)
         self._box.pack_start(self.selection_toolbar.eventbox, False, False, 0)
         self.add(self._box)
-        count = 1
+        count = 0
         cursor = None
         try:
             cursor = tracker.query(Query.all_songs_count(), None)
+            if cursor is not None and cursor.next(None):
+                count = cursor.get_integer(0)
         except Exception as e:
             logger.error("Tracker query crashed: %s" % e)
             count = 0
-        if cursor is not None and cursor.next(None):
-            count = cursor.get_integer(0)
+
         if count > 0:
             self._switch_to_player_view()
         # To revert to the No Music View when no songs are found


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]