Subject: [PATCH 1/3] pretty.c: fix null pointer dereference

From: Mirko Faina <[email-masked]>
Date: Tue, 24 Feb 2026 05:03:56 +0100

commit_format_is_empty() is used to check whether "user_format" is set
to a value. Unfortunately this function crashes the program if no
user_format is set. This is because instead of checking for the pointer
value it checks for its dereferenced value, this being NULL if
user_format is not set.

Teach the proper condition to check if user_format is set.

Signed-off-by: Mirko Faina <[email-masked]>
---
 pretty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pretty.c b/pretty.c
index e0646bbc5d..cdb8bf559d 100644
--- a/pretty.c
+++ b/pretty.c
@@ -47,7 +47,7 @@ static struct cmt_fmt_map *find_commit_format(const char *sought);
 
 int commit_format_is_empty(enum cmit_fmt fmt)
 {
-	return fmt == CMIT_FMT_USERFORMAT && !*user_format;
+	return fmt == CMIT_FMT_USERFORMAT && !user_format;
 }
 
 static void save_user_format(struct rev_info *rev, const char *cp, int is_tformat)
-- 
2.53.0.4.geaa3cc5f7e