diff options
author | Vincent Untz <vuntz@gnome.org> | 2010-07-07 15:16:41 +0200 |
---|---|---|
committer | Vincent Untz <vuntz@gnome.org> | 2010-07-07 15:16:41 +0200 |
commit | 877e7d648d8838aadaab76712582c73d98d5f99f (patch) | |
tree | c21f5a5181c6f8f855c154cb18d0a0a1ac8da0c6 | |
parent | ddcd06ee050e5e6c966f4f80c4cc5e53270eecdf (diff) | |
download | gconf-877e7d648d8838aadaab76712582c73d98d5f99f.tar.gz |
[gsettings] Do not crash when converting a schema with unknown types
-rwxr-xr-x | 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 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 |