Ticket #4608: mcdiff: segmentation fault on empty files merge.

(get_current_hunk): immediately return if hunk list is empty.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-12-04 21:00:12 +03:00
parent f85f7fec29
commit 8548796e75

View File

@ -1926,6 +1926,10 @@ get_current_hunk (WDiff *dview, int *start_line1, int *end_line1, int *start_lin
int ch; int ch;
int res = 0; int res = 0;
/* Is file empty? */
if (a0->len == 0)
return 0;
*start_line1 = 1; *start_line1 = 1;
*start_line2 = 1; *start_line2 = 1;
*end_line1 = 1; *end_line1 = 1;