Unverified Commit 7f075e51 by Rémi Verschelde Committed by GitHub

Merge pull request #32741 from qarmin/fix_string_utf_ascii

Don't use to_utf8() and to_ascii() on empty String
parents 197be41c c62da553
......@@ -316,6 +316,10 @@ struct _VariantCall {
static void _call_String_to_ascii(Variant &r_ret, Variant &p_self, const Variant **p_args) {
String *s = reinterpret_cast<String *>(p_self._data._mem);
if (s->empty()) {
r_ret = PoolByteArray();
return;
}
CharString charstr = s->ascii();
PoolByteArray retval;
......@@ -331,6 +335,10 @@ struct _VariantCall {
static void _call_String_to_utf8(Variant &r_ret, Variant &p_self, const Variant **p_args) {
String *s = reinterpret_cast<String *>(p_self._data._mem);
if (s->empty()) {
r_ret = PoolByteArray();
return;
}
CharString charstr = s->utf8();
PoolByteArray retval;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment