[rygel] core: handle database error gracefully



commit 50e54553485624fdca6d06a4c711b79306286f8f
Author: Jens Georg <mail jensge org>
Date:   Fri Sep 11 13:28:48 2009 +0200

    core: handle database error gracefully

 src/rygel/rygel-media-db-container.vala |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-media-db-container.vala b/src/rygel/rygel-media-db-container.vala
index 68b0c77..6ef8843 100644
--- a/src/rygel/rygel-media-db-container.vala
+++ b/src/rygel/rygel-media-db-container.vala
@@ -25,8 +25,14 @@
 public class Rygel.MediaDBContainer : MediaContainer {
     protected MediaDB media_db;
 
-    public MediaDBContainer (MediaDB media_db, string  id, string title) {
-        var count = media_db.get_child_count (id);
+    public MediaDBContainer (MediaDB media_db, string id, string title) {
+        int count;
+        try {
+            count = media_db.get_child_count (id);
+        } catch (MediaDBError err) {
+            debug("Could not get child count from database: %s", err.message);
+            count = 0;
+        }
         base (id, null, title, count);
 
         this.media_db = media_db;



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