summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorlupoDharkael <izhe@hotmail.es>2019-02-20 16:36:30 +0100
committerlupoDharkael <izhe@hotmail.es>2019-02-20 16:47:25 +0100
commit597aac382b265a783ffb52f43647fcf13245133c (patch)
tree10c8973c0a01d7d25abf06e9c2a4e5eea5b801d9 /core
parentf5f2b5d4af47b51cd1ff887ea2fbd1c3f8aa1eed (diff)
downloadredot-engine-597aac382b265a783ffb52f43647fcf13245133c.tar.gz
Fix wrong bounds check in String::right
Diffstat (limited to 'core')
-rw-r--r--core/ustring.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index c1888c87a7..838907419e 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2945,12 +2945,12 @@ String String::left(int p_pos) const {
String String::right(int p_pos) const {
- if (p_pos >= size())
- return *this;
-
- if (p_pos < 0)
+ if (p_pos >= length())
return "";
+ if (p_pos <= 0)
+ return *this;
+
return substr(p_pos, (length() - p_pos));
}