[rygel] core: Fall-back to template



commit 7cb6408b1061a011b09880ccca235a09109ef814
Author: Jens Georg <mail jensge org>
Date:   Sun Jul 1 16:51:27 2012 +0200

    core: Fall-back to template
    
    If loading of the description file fails, fall-back to the template file
    and generate a new local description.

 src/rygel/rygel-root-device-factory.vala |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/rygel/rygel-root-device-factory.vala b/src/rygel/rygel-root-device-factory.vala
index 200d36a..9906e2f 100644
--- a/src/rygel/rygel-root-device-factory.vala
+++ b/src/rygel/rygel-root-device-factory.vala
@@ -332,7 +332,13 @@ internal class Rygel.RootDeviceFactory {
         var mod2 = info.get_attribute_uint64 (FileAttribute.TIME_MODIFIED);
 
         if (mod1 > mod2) {
-            return new XMLDoc.from_path (path1);
+            // If we fail to load the derived description file, try the
+            // template instead.
+            try {
+                return new XMLDoc.from_path (path1);
+            } catch (Error error) {
+                return new XMLDoc.from_path (path2);
+            }
         } else {
             return new XMLDoc.from_path (path2);
         }



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