소스 검색

Merge pull request #26095 from lupoDharkael/right-left

Fix wrong bounds check in String::right
Rémi Verschelde 6 년 전
부모
커밋
5023cc111b
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      core/ustring.cpp

+ 4 - 4
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));
 }