From 7bb4e74c38642682cfdd0cb4052adfa5efdd7dd1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 9 Dec 2020 12:41:50 +0100 Subject: patch 8.2.2117: some functions use any value as a string Problem: Some functions use any value as a string. Solution: Check that the value is a non-empty string. --- src/mbyte.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/mbyte.c') diff --git a/src/mbyte.c b/src/mbyte.c index 0abb1648f..a4eff7837 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -5551,13 +5551,8 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED) void f_charclass(typval_T *argvars, typval_T *rettv UNUSED) { - if (argvars[0].v_type != VAR_STRING - || argvars[0].vval.v_string == NULL - || *argvars[0].vval.v_string == NUL) - { - emsg(_(e_stringreq)); + if (check_for_string(&argvars[0]) == FAIL) return; - } rettv->vval.v_number = mb_get_class(argvars[0].vval.v_string); } #endif -- cgit v1.2.1