aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-03-06 16:10:04 +0000
committerGitHub <noreply@github.com>2023-03-06 16:10:04 +0000
commit98f2df931ad8657f21124d8a6024967c5997fc99 (patch)
tree923aae5efb34cf5424317b8a44c9e2ea7533fa4d
parent6969d3d7491fc2f10d80309b26dd0c26d211b1b3 (diff)
downloadrneovim-98f2df931ad8657f21124d8a6024967c5997fc99.tar.gz
rneovim-98f2df931ad8657f21124d8a6024967c5997fc99.tar.bz2
rneovim-98f2df931ad8657f21124d8a6024967c5997fc99.zip
fix(diff): add NULL check
-rw-r--r--src/nvim/linematch.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/linematch.c b/src/nvim/linematch.c
index a9dac40731..a15f41d9a8 100644
--- a/src/nvim/linematch.c
+++ b/src/nvim/linematch.c
@@ -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)++;
}
}