aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorcaryoscelus2016-08-26 10:42:01 +0300
committerRémi Verschelde2016-09-01 08:44:30 +0200
commit83864514f910abe052901f4a2ca23e6de92f409a (patch)
tree1620f9801d2c98242eade0d68d17ec28a535cb93 /core
parentb1ea299edfac88da1add0a7ff7e717e3e6b8c49b (diff)
downloadgodot-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')
-rw-r--r--core/variant_op.cpp2
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;