[gconf] [gsettings] Do not crash when converting a schema with unknown types



commit 877e7d648d8838aadaab76712582c73d98d5f99f
Author: Vincent Untz <vuntz gnome org>
Date:   Wed Jul 7 15:16:41 2010 +0200

    [gsettings] Do not crash when converting a schema with unknown types

 gsettings/gsettings-schema-convert |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gsettings/gsettings-schema-convert b/gsettings/gsettings-schema-convert
index 05c6902..36a7e7d 100755
--- a/gsettings/gsettings-schema-convert
+++ b/gsettings/gsettings-schema-convert
@@ -746,9 +746,17 @@ class XMLSchemaParser:
 
 def map_gconf_type_to_variant_type(gconftype, gconfsubtype):
     typemap = { 'string': 's', 'int': 'i', 'float': 'd', 'bool': 'b', 'list': 'a' }
-    result = typemap[gconftype]
+    try:
+        result = typemap[gconftype]
+    except KeyError:
+        raise GSettingsSchemaConvertException('Type \'%s\' is not a known gconf type.' % gconftype)
+
     if gconftype == 'list':
-        result = result + typemap[gconfsubtype]
+        try:
+            result = result + typemap[gconfsubtype]
+        except KeyError:
+            raise GSettingsSchemaConvertException('Type \'%s\' is not a known gconf type.' % gconfsubtype)
+
     return result
 
 



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