diff options
author | lupoDharkael <izhe@hotmail.es> | 2019-02-20 16:36:30 +0100 |
---|---|---|
committer | lupoDharkael <izhe@hotmail.es> | 2019-02-20 16:47:25 +0100 |
commit | 597aac382b265a783ffb52f43647fcf13245133c (patch) | |
tree | 10c8973c0a01d7d25abf06e9c2a4e5eea5b801d9 /core/ustring.cpp | |
parent | f5f2b5d4af47b51cd1ff887ea2fbd1c3f8aa1eed (diff) | |
download | redot-engine-597aac382b265a783ffb52f43647fcf13245133c.tar.gz |
Fix wrong bounds check in String::right
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r-- | core/ustring.cpp | 8 |
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)); } |