From 822af4cd6002e0b332c73aac01efcc7d3a18e329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=99=BD=E4=BA=91?= <71159641+littlewhitecloud@users.noreply.github.com> Date: Sun, 10 Dec 2023 11:21:42 +0800 Subject: [PATCH] nicer check Co-authored-by: Akuli --- src/output.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/output.c b/src/output.c index 2264dfed..ae2f7236 100644 --- a/src/output.c +++ b/src/output.c @@ -112,9 +112,10 @@ static void write_gitinore(const char *p) return; } FILE *gitinore = fopen(filename, "w"); - fprintf(gitinore, "*"); - - fclose(gitinore); + if (gitinore != NULL) { + fprintf(gitinore, "*"); + fclose(gitinore); + } free(filename); }