summaryrefslogtreecommitdiffstats
path: root/core/string/ustring.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-05-22 13:09:34 +0200
committerGitHub <noreply@github.com>2021-05-22 13:09:34 +0200
commit5d2d24202d5e50c44fca1fc706d4677ebda0fc2f (patch)
treec5c3310824316fc889fc40b552dede664b11d449 /core/string/ustring.cpp
parent3b3a55ca04331e85cc24ac315b60e7ad4aeb17df (diff)
parentea9660e1cf8de10ef691e37d562da19ab518a1fb (diff)
downloadredot-engine-5d2d24202d5e50c44fca1fc706d4677ebda0fc2f.tar.gz
Merge pull request #48927 from KoBeWi/I_fixed_your_left
Fix usage of String.left()
Diffstat (limited to 'core/string/ustring.cpp')
-rw-r--r--core/string/ustring.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index 3c1afc7f2c..49cf171f2b 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -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 {