From 83864514f910abe052901f4a2ca23e6de92f409a Mon Sep 17 00:00:00 2001 From: caryoscelus Date: Fri, 26 Aug 2016 10:42:01 +0300 Subject: [PATCH] fix string iterator Since strings are null-terminated, size() returns incorrect length, so use length() instead. fixes #6287 (cherry picked from commit 810fbb70aec2cbe03721c1f6291a81bbae1adc39) --- core/variant_op.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/variant_op.cpp b/core/variant_op.cpp index c537ed230f..fd64b58bd5 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -3046,7 +3046,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { const String *str=reinterpret_cast(_data._mem); int idx = r_iter; idx++; - if (idx >= str->size()) + if (idx >= str->length()) return false; r_iter = idx; return true;