Don't crash if `Function.prototype.call` is called without arguments.

This commit is contained in:
David Wendt 2019-10-20 22:32:52 -04:00
parent 0470b8d0a7
commit d217f51c6c
1 changed files with 6 additions and 1 deletions

View File

@ -26,7 +26,12 @@ pub fn call<'gc>(
Some(Value::Object(this)) => *this,
_ => avm.globals,
};
let args = &myargs[1..];
let empty = [];
let args = match myargs.len() {
0 => &empty,
1 => &empty,
_ => &myargs[1..],
};
match func.as_executable() {
Some(exec) => exec.exec(avm, action_context, this, args),