aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/indent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/indent.c')
-rw-r--r--src/nvim/indent.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index efca739c2d..0d5b82bc5b 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -538,7 +538,14 @@ int get_expr_indent(void)
sandbox++;
}
textlock++;
- indent = (int)eval_to_number(curbuf->b_p_inde);
+
+ // Need to make a copy, the 'indentexpr' option could be changed while
+ // evaluating it.
+ char_u *inde_copy = vim_strsave(curbuf->b_p_inde);
+ if (inde_copy != NULL) {
+ indent = (int)eval_to_number(inde_copy);
+ xfree(inde_copy);
+ }
if (use_sandbox) {
sandbox--;