Merge pull request #48927 from KoBeWi/I_fixed_your_left

Fix usage of String.left()
This commit is contained in:
Rémi Verschelde 2021-05-22 13:09:34 +02:00 committed by GitHub
commit 5d2d24202d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -939,7 +939,7 @@ const char32_t *String::get_data() const {
}
void String::erase(int p_pos, int p_chars) {
*this = left(p_pos) + substr(p_pos + p_chars, length() - ((p_pos + p_chars)));
*this = left(MAX(p_pos, 0)) + substr(p_pos + p_chars, length() - ((p_pos + p_chars)));
}
String String::capitalize() const {