aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/mark.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index bb5b8e8178..4e05845eb5 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -130,9 +130,15 @@ int setmark_pos(int c, pos_T *pos, int fnum)
return OK;
}
+ buf_T *buf = buflist_findnr(fnum);
+ // Can't set a mark in a non-existant buffer.
+ if (buf == NULL) {
+ return FAIL;
+ }
+
if (ASCII_ISLOWER(c)) {
i = c - 'a';
- RESET_FMARK(curbuf->b_namedm + i, *pos, curbuf->b_fnum);
+ RESET_FMARK(buf->b_namedm + i, *pos, fnum);
return OK;
}
if (ASCII_ISUPPER(c) || ascii_isdigit(c)) {