aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrestis Floros <orestisflo@gmail.com>2024-04-30 13:39:54 +0200
committerGitHub <noreply@github.com>2024-04-30 13:39:54 +0200
commite020701df1cca986f64ab7b9d15d6d30a95c1418 (patch)
tree4ee89571b04893fa276209d94083525b03fd9a9b
parent5834b7e8242c5279712452b632d6ec2e9741760b (diff)
downloadi3-e020701df1cca986f64ab7b9d15d6d30a95c1418.tar.gz
i3-e020701df1cca986f64ab7b9d15d6d30a95c1418.zip
errorlog: Check errorfile exists (#6028)
Fixes #6027
-rw-r--r--release-notes/bugfixes/99-errorlog1
-rw-r--r--src/log.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/release-notes/bugfixes/99-errorlog b/release-notes/bugfixes/99-errorlog
new file mode 100644
index 00000000..c647e53e
--- /dev/null
+++ b/release-notes/bugfixes/99-errorlog
@@ -0,0 +1 @@
+fix error log related crash
diff --git a/src/log.c b/src/log.c
index 812eb5b5..c1aa876d 100644
--- a/src/log.c
+++ b/src/log.c
@@ -330,6 +330,9 @@ void errorlog(char *fmt, ...) {
va_end(args);
/* also log to the error logfile, if opened */
+ if (!errorfile) {
+ return;
+ }
va_start(args, fmt);
vfprintf(errorfile, fmt, args);
fflush(errorfile);