diff options
| author | caryoscelus | 2016-08-26 10:42:01 +0300 |
|---|---|---|
| committer | Rémi Verschelde | 2016-09-01 08:44:30 +0200 |
| commit | 83864514f910abe052901f4a2ca23e6de92f409a (patch) | |
| tree | 1620f9801d2c98242eade0d68d17ec28a535cb93 /core/variant_op.cpp | |
| parent | b1ea299edfac88da1add0a7ff7e717e3e6b8c49b (diff) | |
| download | godot-83864514f910abe052901f4a2ca23e6de92f409a.tar.gz godot-83864514f910abe052901f4a2ca23e6de92f409a.tar.zst godot-83864514f910abe052901f4a2ca23e6de92f409a.zip | |
fix string iterator
Since strings are null-terminated, size() returns incorrect length,
so use length() instead.
fixes #6287
(cherry picked from commit 810fbb70aec2cbe03721c1f6291a81bbae1adc39)
Diffstat (limited to 'core/variant_op.cpp')
| -rw-r--r-- | core/variant_op.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp index c537ed230..fd64b58bd 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<const String*>(_data._mem); int idx = r_iter; idx++; - if (idx >= str->size()) + if (idx >= str->length()) return false; r_iter = idx; return true; |
