summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2011-07-12 10:28:07 +0200
committerJens Georg <mail@jensge.org>2011-07-12 10:32:26 +0200
commit2f8b5fc9240270f2501788b68c24d7cfc3fb60a5 (patch)
treefab93f6df4af172d3054f2b7542ef13ec5d9929e
parentc0c710486ac45418ac5990b3bf8007a8e7d0636f (diff)
downloadrygel-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.vala17
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);
+ }
}
}
}