mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
eval: Fix useless NULL check
partial_name() as it is written now really cannot return NULL
This commit is contained in:
@@ -8977,13 +8977,10 @@ static void f_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
if (strcmp(what, "func") == 0 || strcmp(what, "name") == 0) {
|
if (strcmp(what, "func") == 0 || strcmp(what, "name") == 0) {
|
||||||
rettv->v_type = (*what == 'f' ? VAR_FUNC : VAR_STRING);
|
rettv->v_type = (*what == 'f' ? VAR_FUNC : VAR_STRING);
|
||||||
const char *const n = (const char *)partial_name(pt);
|
const char *const n = (const char *)partial_name(pt);
|
||||||
if (n == NULL) {
|
assert(n != NULL);
|
||||||
rettv->vval.v_string = NULL;
|
rettv->vval.v_string = (char_u *)xstrdup(n);
|
||||||
} else {
|
if (rettv->v_type == VAR_FUNC) {
|
||||||
rettv->vval.v_string = (char_u *)xstrdup(n);
|
func_ref(rettv->vval.v_string);
|
||||||
if (rettv->v_type == VAR_FUNC) {
|
|
||||||
func_ref(rettv->vval.v_string);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (strcmp(what, "dict") == 0) {
|
} else if (strcmp(what, "dict") == 0) {
|
||||||
rettv->v_type = VAR_DICT;
|
rettv->v_type = VAR_DICT;
|
||||||
|
Reference in New Issue
Block a user