diff --git a/core/src/avm2/globals/flash/display/movie_clip.rs b/core/src/avm2/globals/flash/display/movie_clip.rs index b13702492..a616fb8f0 100644 --- a/core/src/avm2/globals/flash/display/movie_clip.rs +++ b/core/src/avm2/globals/flash/display/movie_clip.rs @@ -23,11 +23,7 @@ pub fn add_frame_script<'gc>( { for (frame_id, callable) in args.chunks_exact(2).map(|s| (s[0], s[1])) { let frame_id = frame_id.coerce_to_u32(activation)? as u16 + 1; - let callable = if callable == Value::Null { - None - } else { - Some(callable.as_callable(activation, None, None)?) - }; + let callable = callable.as_callable(activation, None, None).ok(); mc.register_frame_script(frame_id, callable, &mut activation.context); } diff --git a/tests/tests/swfs/avm2/movieclip_addframescript/Test.as b/tests/tests/swfs/avm2/movieclip_addframescript/Test.as index 290a5ac54..9b6afff80 100644 --- a/tests/tests/swfs/avm2/movieclip_addframescript/Test.as +++ b/tests/tests/swfs/avm2/movieclip_addframescript/Test.as @@ -7,7 +7,9 @@ public function Test() { - addFrameScript(0, frame1, 1, frame2a, 1, frame2b, 2, frame3, 2, null, 3, frame4); + addFrameScript(1, undefined); + addFrameScript(0, frame1, 1, frame2a, 1, frame2b, 2, frame3, 2, null, 3, frame4, 4, frame5); + addFrameScript(3, "primitive"); } function frame1() { @@ -28,6 +30,10 @@ function frame4() { trace("Frame 4"); + } + + function frame5() { + trace("Frame 5"); stop(); } } diff --git a/tests/tests/swfs/avm2/movieclip_addframescript/output.txt b/tests/tests/swfs/avm2/movieclip_addframescript/output.txt index b4e719a19..d3501260e 100644 --- a/tests/tests/swfs/avm2/movieclip_addframescript/output.txt +++ b/tests/tests/swfs/avm2/movieclip_addframescript/output.txt @@ -1,3 +1,3 @@ Frame 1 Frame 2b -Frame 4 +Frame 5 diff --git a/tests/tests/swfs/avm2/movieclip_addframescript/test.fla b/tests/tests/swfs/avm2/movieclip_addframescript/test.fla deleted file mode 100644 index e0e203911..000000000 Binary files a/tests/tests/swfs/avm2/movieclip_addframescript/test.fla and /dev/null differ diff --git a/tests/tests/swfs/avm2/movieclip_addframescript/test.swf b/tests/tests/swfs/avm2/movieclip_addframescript/test.swf index f5ce1a728..4510665fd 100644 Binary files a/tests/tests/swfs/avm2/movieclip_addframescript/test.swf and b/tests/tests/swfs/avm2/movieclip_addframescript/test.swf differ diff --git a/tests/tests/swfs/avm2/movieclip_addframescript/test.toml b/tests/tests/swfs/avm2/movieclip_addframescript/test.toml index 6236b8239..1e15fdf27 100644 --- a/tests/tests/swfs/avm2/movieclip_addframescript/test.toml +++ b/tests/tests/swfs/avm2/movieclip_addframescript/test.toml @@ -1 +1 @@ -num_frames = 4 +num_frames = 5