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.
diff --git a/src/typval.c b/src/typval.c
index 0e2513a..64112e7 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -341,6 +341,22 @@
 #endif
 
 /*
+ * Give an error and return FAIL unless "tv" is a non-empty string.
+ */
+    int
+check_for_string(typval_T *tv)
+{
+    if (tv->v_type != VAR_STRING
+	    || tv->vval.v_string == NULL
+	    || *tv->vval.v_string == NUL)
+    {
+	emsg(_(e_stringreq));
+	return FAIL;
+    }
+    return OK;
+}
+
+/*
  * Get the string value of a variable.
  * If it is a Number variable, the number is converted into a string.
  * tv_get_string() uses a single, static buffer.  YOU CAN ONLY USE IT ONCE!