Return an empty string in substr if len is 0.

This commit is contained in:
Relintai 2022-02-06 10:10:30 +01:00
parent 772dd028d9
commit 3b4d7a723d

View File

@ -174,6 +174,10 @@ void String::get_substr_nt(char *into_buf, const int start_index, const int len)
}
String String::substr(const int start_index, const int len) const {
if (len == 0) {
return String();
}
ERR_FAIL_INDEX_V(start_index, _size, String());
int sil = start_index + len;