aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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)++;
}
}