log: check if log_charset is set
When logging to a file, log_charset would be NULL and g_convert() would abort.
This commit is contained in:
parent
fce8fa0b31
commit
5b2e981253
13
src/log.c
13
src/log.c
@ -75,11 +75,14 @@ mpd_log_func(G_GNUC_UNUSED const gchar *log_domain,
|
|||||||
? stderr : stdout;
|
? stderr : stdout;
|
||||||
char *converted;
|
char *converted;
|
||||||
|
|
||||||
converted = g_convert_with_fallback(message, -1,
|
if (log_charset != NULL) {
|
||||||
log_charset, "utf-8",
|
converted = g_convert_with_fallback(message, -1,
|
||||||
NULL, NULL, NULL, NULL);
|
log_charset, "utf-8",
|
||||||
if (converted != NULL)
|
NULL, NULL, NULL, NULL);
|
||||||
message = converted;
|
if (converted != NULL)
|
||||||
|
message = converted;
|
||||||
|
} else
|
||||||
|
converted = NULL;
|
||||||
|
|
||||||
fprintf(file, "%s%s",
|
fprintf(file, "%s%s",
|
||||||
stdout_mode ? "" : log_date(),
|
stdout_mode ? "" : log_date(),
|
||||||
|
Loading…
Reference in New Issue
Block a user