summaryrefslogtreecommitdiff
path: root/src/patch_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/patch_parse.c')
-rw-r--r--src/patch_parse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 3e78d8ca7..545f1ca9e 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -928,8 +928,8 @@ static int check_filenames(git_patch_parsed *patch)
prefixed_old = (!added && patch->old_path) ? patch->old_path : patch->header_old_path;
prefixed_new = (!deleted && patch->new_path) ? patch->new_path : patch->header_new_path;
- if (check_prefix(&patch->old_prefix, &old_prefixlen, patch, prefixed_old) < 0 ||
- check_prefix(&patch->new_prefix, &new_prefixlen, patch, prefixed_new) < 0)
+ if ((prefixed_old && check_prefix(&patch->old_prefix, &old_prefixlen, patch, prefixed_old) < 0) ||
+ (prefixed_new && check_prefix(&patch->new_prefix, &new_prefixlen, patch, prefixed_new) < 0))
return -1;
/* Prefer the rename filenames as they are unambiguous and unprefixed */