summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 35b817b1d2..686aa6f8e3 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2331,6 +2331,9 @@ String String::insert(int p_at_pos, const String &p_string) const {
}
String String::substr(int p_from, int p_chars) const {
+ if (p_chars == -1)
+ p_chars = length() - p_from;
+
if (empty() || p_from < 0 || p_from >= length() || p_chars <= 0)
return "";