diff options
author | Jens Georg <mail@jensge.org> | 2011-07-12 10:28:07 +0200 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2011-07-12 10:32:26 +0200 |
commit | 2f8b5fc9240270f2501788b68c24d7cfc3fb60a5 (patch) | |
tree | fab93f6df4af172d3054f2b7542ef13ec5d9929e | |
parent | c0c710486ac45418ac5990b3bf8007a8e7d0636f (diff) | |
download | rygel-2f8b5fc9240270f2501788b68c24d7cfc3fb60a5.tar.gz |
core: Work-around a GObject constructor abuse
GUPnPRootDevice defines a constructor that returns NULL on error,
causing a crash since vala rightfully isn't expecting that.
-rw-r--r-- | src/rygel/rygel-root-device.vala | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/rygel/rygel-root-device.vala b/src/rygel/rygel-root-device.vala index fcce5f16..99849667 100644 --- a/src/rygel/rygel-root-device.vala +++ b/src/rygel/rygel-root-device.vala @@ -41,15 +41,18 @@ internal class Rygel.RootDevice: GUPnP.RootDevice { description_path: description_path, description_dir: description_dir); - this.services = new ArrayList<ServiceInfo> (); + // Yes, this can happen. + if (this != null) { + this.services = new ArrayList<ServiceInfo> (); - // Now create the sevice objects - foreach (ResourceInfo info in plugin.resource_infos) { - // FIXME: We only support plugable services for now - if (info.type.is_a (typeof (Service))) { - var service = this.get_service (info.upnp_type); + // Now create the sevice objects + foreach (ResourceInfo info in plugin.resource_infos) { + // FIXME: We only support plugable services for now + if (info.type.is_a (typeof (Service))) { + var service = this.get_service (info.upnp_type); - this.services.add (service); + this.services.add (service); + } } } } |