diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2009-02-19 12:30:30 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2009-02-19 12:30:30 +0100 |
commit | 0ca39f974b6419ca9a428d2f8cde72ee20a3f8c0 (patch) | |
tree | 8e026a590e626a130c47f04adb7859b7951c7bcd | |
parent | c76fa7e733f973fddf0379907468fa7681a5e2e7 (diff) | |
download | weechat-0ca39f974b6419ca9a428d2f8cde72ee20a3f8c0.zip |
Fix bug in config_file_write_line with empty value, when called from script plugins
-rw-r--r-- | src/core/wee-config-file.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index 738441505..14a982628 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -1709,19 +1709,22 @@ config_file_write_line (struct t_config_file *config_file, if (!config_file || !option_name) return; - if (value) + if (value && value[0]) { va_start (argptr, value); vsnprintf (buf, sizeof (buf) - 1, value, argptr); va_end (argptr); - string_iconv_fprintf (config_file->file, "%s = %s\n", - option_name, buf); - } - else - { - string_iconv_fprintf (config_file->file, "\n[%s]\n", - option_name); + + if (buf[0]) + { + string_iconv_fprintf (config_file->file, "%s = %s\n", + option_name, buf); + return; + } } + + string_iconv_fprintf (config_file->file, "\n[%s]\n", + option_name); } /* |