[gnome-ostree] snapshot: Deal with no patches field



commit 3e016b6b26462205afd7ed7a2ee330b87c367df3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Jun 15 22:43:08 2013 -0400

    snapshot: Deal with no patches field
    
    Without this, it will create an undefined component which will
    confuse everything iterating over the components list.

 src/js/snapshot.js |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/js/snapshot.js b/src/js/snapshot.js
index ec57e0e..dfa9bee 100644
--- a/src/js/snapshot.js
+++ b/src/js/snapshot.js
@@ -34,8 +34,11 @@ function _componentDict(snapshot) {
             throw new Error("Duplicate component name " + name);
         r[name] = component;
     }
+
     let patches = snapshot['patches'];
-    r[patches['name']] = patches;
+    if (patches['name'])
+        r[patches['name']] = patches;
+
     let base = snapshot['base'];
     r[base['name']] = base;
     return r;


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