diff options
| author | George Marques | 2016-06-24 12:39:58 -0300 |
|---|---|---|
| committer | Rémi Verschelde | 2016-06-25 02:04:27 +0200 |
| commit | c015341221bfa1fbb64067ce0499ce5b1527ee37 (patch) | |
| tree | 319457e68f1390db3e73eb8371fd37cf7e3e4bac | |
| parent | 6e49bc821025067e03341bc6e08ceab2acc81a88 (diff) | |
| download | godot-c015341221bfa1fbb64067ce0499ce5b1527ee37.tar.gz godot-c015341221bfa1fbb64067ce0499ce5b1527ee37.tar.zst godot-c015341221bfa1fbb64067ce0499ce5b1527ee37.zip | |
Fix bug in String==StrRange comparison
It was comparing the StrRange with itself, always return true if both
were the same length.
Fix #3843
(cherry picked from commit f4dfa37a23629e011dac74911a87860edf83c63d)
| -rw-r--r-- | core/ustring.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 061a5c5f9..4d41d6e22 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -256,13 +256,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; |
