fix for crash when no logfile was selected
This commit is contained in:
parent
d725a0ab3d
commit
f21ca8f56c
1 changed files with 2 additions and 2 deletions
4
log.cpp
4
log.cpp
|
@ -30,7 +30,7 @@ void setlog(const char *lf, const log_level_t ll_file, const log_level_t ll_scre
|
||||||
|
|
||||||
free((void *)logfile);
|
free((void *)logfile);
|
||||||
|
|
||||||
logfile = strdup(lf);
|
logfile = lf ? strdup(lf) : nullptr;
|
||||||
|
|
||||||
log_level_file = ll_file;
|
log_level_file = ll_file;
|
||||||
log_level_screen = ll_screen;
|
log_level_screen = ll_screen;
|
||||||
|
@ -51,7 +51,7 @@ void closelog()
|
||||||
|
|
||||||
void dolog(const log_level_t ll, const char *fmt, ...)
|
void dolog(const log_level_t ll, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
if (ll < log_level_file && ll < log_level_screen)
|
if ((ll < log_level_file && ll < log_level_screen) || !logfile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!lfh) {
|
if (!lfh) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue