Commit 5b2e9812 authored by Max Kellermann's avatar Max Kellermann

log: check if log_charset is set

When logging to a file, log_charset would be NULL and g_convert() would abort.
parent fce8fa0b
......@@ -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(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment