String.Right() does not crash anymore on invalid UTF-8 strings.

[INTERPRETER]
* BUG: String.Right() does not crash anymore on invalid UTF-8 strings.
This commit is contained in:
gambas 2019-03-08 12:28:41 +01:00
parent 463bc16b47
commit c7d6ddd31f

View file

@ -535,6 +535,8 @@ static void String_Right(ushort code)
val = utf8_get_length(str, len) - val;
ulen = utf8_get_pos(ref, str, len, val);
if (ulen > len)
ulen = len;
PARAM->_string.start += ulen;
PARAM->_string.len -= ulen;