fix(options): crash on ":let &t_Co = v:true" #41152

Problem:
Assigning a Boolean or special value (v:true/v:false/v:null/v:none) to a TTY
option aborts:

    Assertion failed: (curval.type == newval.type), function ex_let_option, file vars.c, line 1408.
    3   libsystem_c.dylib   __assert_rtn + 284
    4   nvim                ex_let_one + 3308
    5   nvim                ex_let_vars + 112
    6   nvim                ex_let + 2356
    7   nvim                execute_cmd0 + 252
    8   nvim                do_cmdline + 9076
    9   nvim                call_user_func + 3320
    10  nvim                call_func + 2076
    11  nvim                get_func_tv + 696
    12  nvim                eval_func + 380
    20  nvim                eval_to_string_eap + 276
    21  nvim                eval_map_expr + 444
    22  nvim                vgetorpeek + 3172
    23  nvim                vgetc + 764

Solution:
Apply the string-type check to TTY options too, so a Boolean/special value
gives "E928: String required" instead of aborting. Valid string/number
assignments to `t_*` pseudo-options still silently no-op.
This commit is contained in:
Justin M. Keyes
2026-08-04 07:06:47 -04:00
committed by GitHub
parent dab5fab948
commit 597555ebc0
2 changed files with 10 additions and 1 deletions

View File

@@ -3246,7 +3246,7 @@ static Object opt_from_tv(typval_T *tv, OptIndex opt_idx, const char *option, bo
const char *strval = tv_get_string_buf_chk(tv, nbuf);
err = strval == NULL;
value = CSTR_TO_OBJ(strval);
} else if (!is_tty_opt) {
} else {
err = true;
emsg(_(e_string_required));
}