summaryrefslogtreecommitdiff
path: root/builtin/blame.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/blame.c')
-rw-r--r--builtin/blame.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index 12c765acfe..4d52f9602e 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -2245,7 +2245,8 @@ static void verify_working_tree_path(struct commit *work_tree, const char *path)
pos = cache_name_pos(path, strlen(path));
if (pos >= 0)
; /* path is in the index */
- else if (!strcmp(active_cache[-1 - pos]->name, path))
+ else if (-1 - pos < active_nr &&
+ !strcmp(active_cache[-1 - pos]->name, path))
; /* path is in the index, unmerged */
else
die("no such path '%s' in HEAD", path);