[gnome-tweak-tool] Don't barf up on potentially bad schemas



commit 2db07a3058d2c6fc1e9903d8ece44c25da4c068b
Author: Alex Bennee <alex bennee com>
Date:   Wed Nov 9 13:52:45 2011 +0000

    Don't barf up on potentially bad schemas
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663695

 gtweak/gsettings.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtweak/gsettings.py b/gtweak/gsettings.py
index e59a101..ea21927 100644
--- a/gtweak/gsettings.py
+++ b/gtweak/gsettings.py
@@ -42,13 +42,18 @@ class _GSettingsSchema:
                 if schema_name == schema.getAttribute("id"):
                     for key in schema.getElementsByTagName("key"):
                         #summary is compulsory, description is optional
-                        summary = key.getElementsByTagName("summary")[0].childNodes[0].data
+                        summary = key.getElementsByTagName("summary")
+                        try:
+                            summary_text = summary[0].childNodes[0].data
+                        except:
+                            summary_text = ""
+                            logging.warning("Schema %s missing summary text: %s" % (schema_path, key.toxml()))
                         try:
                             description = key.getElementsByTagName("description")[0].childNodes[0].data
                         except:
                             description = ""
                         self._schema[key.getAttribute("name")] = {
-                                "summary"       :   summary,
+                                "summary"       :   summary_text,
                                 "description"   :   description
                         }
         except:



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