summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/til_settings.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/til_settings.c b/src/til_settings.c
index 510dbaf..08098d5 100644
--- a/src/til_settings.c
+++ b/src/til_settings.c
@@ -295,15 +295,18 @@ int til_settings_get_and_describe_value(const til_settings_t *settings, const ti
/* add key,value as a new setting to settings,
- * NULL keys and/or values are passed through as-is
+ * NULL keys are passed through as-is
+ * values must not be NULL
* desc may be NULL, it's simply passed along as a passenger.
*/
/* returns the added setting, or NULL on error (ENOMEM) */
til_setting_t * til_settings_add_value(til_settings_t *settings, const char *key, const char *value, const til_setting_desc_t *desc)
{
assert(settings);
+ assert(value);
+ /* XXX: ^^ non-NULL values makes til_settings_get_value_by_idx() NULL-return-for-end-of-settings OK */
- return add_setting(settings, key ? strdup(key) : NULL, value ? strdup(value) : NULL, desc);
+ return add_setting(settings, key ? strdup(key) : NULL, strdup(value), desc);
}
© All Rights Reserved