Don't remove stderr logger if it fail to create

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-02-11 22:58:16 +00:00
parent fc2353d186
commit df69749804
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 4 additions and 1 deletions

View File

@ -2735,7 +2735,10 @@ session_init(int argc, char **argv, Display *dpy, const char *config_file,
auto l = file_logger_new(ps->o.logpath);
if (l) {
log_info("Switching to log file: %s", ps->o.logpath);
log_remove_target_tls(stderr_logger);
if (stderr_logger) {
log_remove_target_tls(stderr_logger);
stderr_logger = NULL;
}
log_add_target_tls(l);
stderr_logger = NULL;
} else {