summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2010-07-07 15:16:41 +0200
committerVincent Untz <vuntz@gnome.org>2010-07-07 15:16:41 +0200
commit877e7d648d8838aadaab76712582c73d98d5f99f (patch)
treec21f5a5181c6f8f855c154cb18d0a0a1ac8da0c6
parentddcd06ee050e5e6c966f4f80c4cc5e53270eecdf (diff)
downloadgconf-877e7d648d8838aadaab76712582c73d98d5f99f.tar.gz
[gsettings] Do not crash when converting a schema with unknown types
-rwxr-xr-xgsettings/gsettings-schema-convert12
1 files changed, 10 insertions, 2 deletions
diff --git a/gsettings/gsettings-schema-convert b/gsettings/gsettings-schema-convert
index 05c69025..36a7e7d8 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