diff options
author | Max Kellermann <max@duempel.org> | 2008-11-05 21:40:08 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-05 21:40:08 +0100 |
commit | 5b2e98125331fc286d8923fa14335383f2c82a05 (patch) | |
tree | ddf2d682847e1261f5423f1325235b6ad5ca15a3 /src | |
parent | fce8fa0b319ee2017adaab10d46ffe57da6a9524 (diff) | |
download | mpd-5b2e98125331fc286d8923fa14335383f2c82a05.tar.gz mpd-5b2e98125331fc286d8923fa14335383f2c82a05.tar.xz mpd-5b2e98125331fc286d8923fa14335383f2c82a05.zip |
log: check if log_charset is set
When logging to a file, log_charset would be NULL and g_convert()
would abort.
Diffstat (limited to 'src')
-rw-r--r-- | src/log.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -75,11 +75,14 @@ mpd_log_func(G_GNUC_UNUSED const gchar *log_domain, ? stderr : stdout; char *converted; - converted = g_convert_with_fallback(message, -1, - log_charset, "utf-8", - NULL, NULL, NULL, NULL); - if (converted != NULL) - message = converted; + if (log_charset != NULL) { + converted = g_convert_with_fallback(message, -1, + log_charset, "utf-8", + NULL, NULL, NULL, NULL); + if (converted != NULL) + message = converted; + } else + converted = NULL; fprintf(file, "%s%s", stdout_mode ? "" : log_date(), |