[rygel] core: Prevent critical when device is not a DMS



commit 2d87b8e50c1283615c09dc8dbf9578094474e4ee
Author: Jens Georg <mail jensge org>
Date:   Thu Dec 15 21:02:54 2011 +0100

    core: Prevent critical when device is not a DMS

 src/rygel/rygel-v1-hacks.vala   |    6 +++++-
 src/rygel/rygel-xbox-hacks.vala |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-v1-hacks.vala b/src/rygel/rygel-v1-hacks.vala
index 8fe1733..776ff10 100644
--- a/src/rygel/rygel-v1-hacks.vala
+++ b/src/rygel/rygel-v1-hacks.vala
@@ -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,
diff --git a/src/rygel/rygel-xbox-hacks.vala b/src/rygel/rygel-xbox-hacks.vala
index e346155..bf3b8bf 100644
--- a/src/rygel/rygel-xbox-hacks.vala
+++ b/src/rygel/rygel-xbox-hacks.vala
@@ -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);



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