[rygel] media-export: handle DBus registration failure



commit f497244d62fcd68659fe629d4f06aa9818abc2b6
Author: Jens Georg <mail jensge org>
Date:   Wed Sep 30 14:21:37 2009 +0200

    media-export: handle DBus registration failure

 .../rygel-media-export-dbus-service.vala           |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-dbus-service.vala b/src/plugins/media-export/rygel-media-export-dbus-service.vala
index f3e61d5..a50db3d 100644
--- a/src/plugins/media-export/rygel-media-export-dbus-service.vala
+++ b/src/plugins/media-export/rygel-media-export-dbus-service.vala
@@ -29,9 +29,13 @@ public class Rygel.MediaExportDBusService : Object {
                                                             throws GLib.Error {
         this.root_container = root_container;
 
-        var conn = DBus.Bus.get (DBus.BusType. SESSION);
-
-        conn.register_object (RYGEL_MEDIA_EXPORT_PATH, this);
+        try {
+            var conn = DBus.Bus.get (DBus.BusType. SESSION);
+            if (conn != null)
+                conn.register_object (RYGEL_MEDIA_EXPORT_PATH, this);
+        } catch (DBus.Error err) {
+            warning ("Failed to attach to DBus session bus: %s", err.message);
+        }
     }
 
     public void AddUri (string uri) {



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