vim-patch:8.2.3767: crash when using NULL partial

Problem:    Crash when using NULL partial.
Solution:   Check for NULL.

e8a92b6166

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2025-12-19 15:47:29 +08:00
parent f15c28ed7a
commit a274bdf2d1

View File

@@ -354,7 +354,7 @@ static int TYPVAL_ENCODE_CONVERT_ONE_VALUE(
partial_T *const pt = tv->vval.v_partial;
char *const fun = pt == NULL ? NULL : partial_name(pt);
// When using uf_name prepend "g:" for a global function.
const char *const prefix = fun != NULL && pt->pt_name == NULL
const char *const prefix = fun != NULL && pt != NULL && pt->pt_name == NULL
&& ASCII_ISUPPER(fun[0]) ? "g:" : "";
(void)prefix;
TYPVAL_ENCODE_CONV_FUNC_START(tv, fun, prefix);