From 6a1d0e32dea3ddfa06e0ec3f33904982ea2c4902 Mon Sep 17 00:00:00 2001 From: Lord-McSweeney <84632019+Lord-McSweeney@users.noreply.github.com> Date: Sat, 16 Sep 2023 07:12:07 -0700 Subject: [PATCH] avm2: Minor fix to string_wrapping_index This improves the ecma3/String/substr test. --- core/src/avm2/globals/string.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/avm2/globals/string.rs b/core/src/avm2/globals/string.rs index cd0664f5c..c0c55986c 100644 --- a/core/src/avm2/globals/string.rs +++ b/core/src/avm2/globals/string.rs @@ -716,7 +716,7 @@ fn string_index(i: f64, len: usize) -> usize { /// Negative values will count backwards from `len`. /// The returned index will be within the range of `[0, len]`. fn string_wrapping_index(i: f64, len: usize) -> usize { - if i < 0. { + if (i as isize) < 0 { if i.is_infinite() { return 0; }