Browse Source

fix string iterator

Since strings are null-terminated, size() returns incorrect length,
so use length() instead.

fixes #6287

(cherry picked from commit 810fbb70aec2cbe03721c1f6291a81bbae1adc39)
caryoscelus 9 years ago
parent
commit
83864514f9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      core/variant_op.cpp

+ 1 - 1
core/variant_op.cpp

@@ -3046,7 +3046,7 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const {
 			const String *str=reinterpret_cast<const String*>(_data._mem);
 			const String *str=reinterpret_cast<const String*>(_data._mem);
 			int idx = r_iter;
 			int idx = r_iter;
 			idx++;
 			idx++;
-			if (idx >= str->size())
+			if (idx >= str->length())
 				return false;
 				return false;
 			r_iter = idx;
 			r_iter = idx;
 			return true;
 			return true;