summaryrefslogtreecommitdiff
path: root/exec_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'exec_cmd.c')
-rw-r--r--exec_cmd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/exec_cmd.c b/exec_cmd.c
index e508f1e66d..f8f416b646 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -22,7 +22,11 @@ const char *system_path(const char *path)
const char *git_extract_argv0_path(const char *argv0)
{
- const char *slash = argv0 + strlen(argv0);
+ const char *slash;
+
+ if (!argv0 || !*argv0)
+ return NULL;
+ slash = argv0 + strlen(argv0);
while (argv0 <= slash && !is_dir_sep(*slash))
slash--;