summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/kim/lib/mac/kim_os_preferences.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/kim/lib/mac/kim_os_preferences.c b/src/kim/lib/mac/kim_os_preferences.c
index 0b48a7fbb..87700ef89 100644
--- a/src/kim/lib/mac/kim_os_preferences.c
+++ b/src/kim/lib/mac/kim_os_preferences.c
@@ -226,7 +226,7 @@ static kim_error kim_os_preferences_set_value (kim_preference_key in_key,
kim_error err = KIM_NO_ERROR;
CFStringRef key = NULL;
- if (!err && !in_value) { err = check_error (KIM_NULL_PARAMETER_ERR); }
+ /* in_value may be NULL if removing the key */
if (!err) {
key = kim_os_preferences_cfstring_for_key (in_key);
@@ -890,18 +890,19 @@ kim_error kim_os_preferences_set_options_for_key (kim_preference_key in_key,
/* in_options may be KIM_OPTIONS_DEFAULT, in which case we empty the dict */
- if (!err) {
+ if (!err && in_options) {
dictionary = CFDictionaryCreateMutable (kCFAllocatorDefault, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
if (!dictionary) { err = check_error (KIM_OUT_OF_MEMORY_ERR); }
- }
-
- if (!err && in_options) {
- err = kim_os_preferences_options_to_dictionary (in_options, dictionary);
+
+ if (!err) {
+ err = kim_os_preferences_options_to_dictionary (in_options, dictionary);
+ }
}
if (!err) {
+ /* NULL dictioray will remove any entry for this key */
err = kim_os_preferences_set_value (in_key, dictionary);
}