git-format-patch: do not crash with format.headers without value.
[gitweb.git] / builtin-log.c
index 7397a5af07c1bd1889d5c0bc2959060401f48829..1cd9d3f76834b40eb217cbb36784b85d5d076e3a 100644 (file)
@@ -202,7 +202,11 @@ static const char *fmt_patch_suffix = ".txt";
 static int git_format_config(const char *var, const char *value)
 {
        if (!strcmp(var, "format.headers")) {
-               int len = strlen(value);
+               int len;
+
+               if (!value)
+                       die("format.headers without value");
+               len = strlen(value);
                extra_headers_size += len + 1;
                extra_headers = xrealloc(extra_headers, extra_headers_size);
                extra_headers[extra_headers_size - len - 1] = 0;