core: Prevent critical when device is not a DMS
authorJens Georg <mail@jensge.org>
Thu, 15 Dec 2011 20:02:54 +0000 (21:02 +0100)
committerJens Georg <mail@jensge.org>
Thu, 15 Dec 2011 20:02:54 +0000 (21:02 +0100)
src/rygel/rygel-v1-hacks.vala
src/rygel/rygel-xbox-hacks.vala

index 8fe1733..776ff10 100644 (file)
@@ -78,11 +78,15 @@ internal class Rygel.V1Hacks : ClientHacks {
     }
 
     public void apply_on_device (RootDevice device,
-                                 string     template_path) throws Error {
+                                 string?    template_path) throws Error {
         if (!device.get_device_type ().has_prefix (DMS)) {
             return;
         }
 
+        if (template_path == null) {
+            return;
+        }
+
         var description_file = new DescriptionFile (template_path);
         description_file.set_device_type (DMS_V1);
         description_file.modify_service_type (ContentDirectory.UPNP_TYPE,
index e346155..bf3b8bf 100644 (file)
@@ -59,11 +59,15 @@ internal class Rygel.XBoxHacks : ClientHacks {
     }
 
     public void apply_on_device (RootDevice device,
-                                 string     template_path) throws Error {
+                                 string?    template_path) throws Error {
         if (!device.get_device_type ().has_prefix (DMS)) {
             return;
         }
 
+        if (template_path == null) {
+            return;
+        }
+
         var description_file = new DescriptionFile (template_path);
         description_file.set_model_name (MODEL_NAME);
         description_file.set_model_number (MODEL_VERSION);