Don't use to_utf8() and to_ascii() on empty String
This commit is contained in:
parent
0148112730
commit
c62da553cb
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue