fix(diff): add NULL check

This commit is contained in:
Lewis Russell 2023-03-06 16:10:04 +00:00 committed by GitHub
parent 6969d3d749
commit 98f2df931a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,6 +161,9 @@ void fastforward_buf_to_lnum(const char **s, long lnum)
{
for (long i = 0; i < lnum - 1; i++) {
*s = strchr(*s, '\n');
if (!*s) {
return;
}
(*s)++;
}
}