summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/buffer.c b/src/buffer.c
index bc5dd5b47..328c2b37c 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -888,8 +888,13 @@ init_changedtick(buf_T *buf)
di->di_tv.v_type = VAR_NUMBER;
di->di_tv.v_lock = VAR_FIXED;
di->di_tv.vval.v_number = 0;
- dict_add(buf->b_vars, di);
- buf->b_changedtick = &di->di_tv.vval.v_number;
+ if (dict_add(buf->b_vars, di) == OK)
+ buf->b_changedtick = &di->di_tv.vval.v_number;
+ else
+ {
+ vim_free(di);
+ buf->b_changedtick = &buf->b_ct_val;
+ }
}
else
#endif