summaryrefslogtreecommitdiff
path: root/builtin-help.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-help.c')
-rw-r--r--builtin-help.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-help.c b/builtin-help.c
index 335fe5fedc..bc1b4da3bc 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -229,7 +229,7 @@ int cmd_version(int argc, const char **argv, char **envp)
int cmd_help(int argc, const char **argv, char **envp)
{
- const char *help_cmd = argv[1];
+ const char *help_cmd = argc > 1 ? argv[1] : NULL;
if (!help_cmd)
cmd_usage(0, git_exec_path(), NULL);
else if (!strcmp(help_cmd, "--all") || !strcmp(help_cmd, "-a"))