فهرست منبع

Fix bug in String==StrRange comparison

It was comparing the StrRange with itself, always return true if both
were the same length.

Fix #3843
George Marques 9 سال پیش
والد
کامیت
f4dfa37a23
1فایلهای تغییر یافته به همراه2 افزوده شده و 5 حذف شده
  1. 2 5
      core/ustring.cpp

+ 2 - 5
core/ustring.cpp

@@ -257,13 +257,10 @@ bool String::operator==(const StrRange &p_range) const {
 		return true;
 
 	const CharType *c_str=p_range.c_str;
-
-	int l=length();
-
-	const CharType *dst = p_range.c_str;
+	const CharType *dst = &operator[](0);
 
 	/* Compare char by char */
-	for (int i=0;i<l;i++) {
+	for (int i=0;i<len;i++) {
 
 		if (c_str[i]!=dst[i])
 			return false;