Commit 9d6b6c5d by Iliyas Jorio Committed by Edward Thomson

diff_delta_format_path: handle null filename

This fixes a crash in test cases
test_diff_parse__new_file_with_space_and_regenerate_patch
and
test_diff_parse__delete_file_with_space_and_regenerate_patch
parent 8e29fa38
...@@ -316,6 +316,12 @@ static int diff_print_oid_range( ...@@ -316,6 +316,12 @@ static int diff_print_oid_range(
static int diff_delta_format_path( static int diff_delta_format_path(
git_str *out, const char *prefix, const char *filename) git_str *out, const char *prefix, const char *filename)
{ {
if (!filename)
{
/* don't prefix "/dev/null" */
return git_str_puts(out, "/dev/null");
}
if (git_str_joinpath(out, prefix, filename) < 0) if (git_str_joinpath(out, prefix, filename) < 0)
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment