summaryrefslogtreecommitdiffstats
path: root/core/string/ustring.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2021-05-21 15:17:43 +0200
committerkobewi <kobewi4e@gmail.com>2021-05-21 23:01:44 +0200
commitea9660e1cf8de10ef691e37d562da19ab518a1fb (patch)
tree204590ebd6ac91fa345b83d7a08d68abe050da2f /core/string/ustring.cpp
parent8c2beeea907cb39baac20df198392ae4fdf64029 (diff)
downloadredot-engine-ea9660e1cf8de10ef691e37d562da19ab518a1fb.tar.gz
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 {