Merge pull request #26095 from lupoDharkael/right-left

Fix wrong bounds check in String::right
This commit is contained in:
Rémi Verschelde 2019-02-20 17:48:53 +01:00 committed by GitHub
commit 5023cc111b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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));
}