[rygel] fix handling of nonexistant gconf key



commit ac1da35a53176d318de6488469d6aa54d8dd59f4
Author: Jens Georg <mail jensge org>
Date:   Sat May 2 16:46:54 2009 +0200

    fix handling of nonexistant gconf key
---
 .../mediathek/rygel-mediathek-container-root.vala  |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/plugins/mediathek/rygel-mediathek-container-root.vala b/src/plugins/mediathek/rygel-mediathek-container-root.vala
index 6984f61..86d7c83 100644
--- a/src/plugins/mediathek/rygel-mediathek-container-root.vala
+++ b/src/plugins/mediathek/rygel-mediathek-container-root.vala
@@ -96,20 +96,25 @@ public class ZdfMediathek.ZdfRootContainer : MediaContainer {
         this.items = new ArrayList<RssContainer>();
 
         this.gconf = GConf.Client.get_default();
+        unowned SList<int> feeds = null;
 
         // get subscribed feeds
         try {
             // TODO get gconf prefix from Rygel
-            unowned GLib.SList<int> feeds = 
-                gconf.get_list("/apps/rygel/ZDFMediathek/rss",
+            feeds = gconf.get_list("/apps/rygel/ZDFMediathek/rss",
                                 GConf.ValueType.INT);
 
-            foreach (int id in feeds) {
-                this.items.add(new RssContainer(this, id));
-            }
         } catch (GLib.Error error) {
+            message("Error on getting configuration: %s", error.message);
+        }
+
+        if (feeds == null) {
             message("Could not get RSS items from GConf, using defaults");
-            this.items.add(new RssContainer(this, 508));
+            feeds.append(508);
+        }
+
+        foreach (int id in feeds) {
+            this.items.add(new RssContainer(this, id));
         }
 
         this.child_count = this.items.size;



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