Don't crash if `Function.prototype.call` is called without arguments.
This commit is contained in:
parent
0470b8d0a7
commit
d217f51c6c
|
@ -26,7 +26,12 @@ pub fn call<'gc>(
|
||||||
Some(Value::Object(this)) => *this,
|
Some(Value::Object(this)) => *this,
|
||||||
_ => avm.globals,
|
_ => avm.globals,
|
||||||
};
|
};
|
||||||
let args = &myargs[1..];
|
let empty = [];
|
||||||
|
let args = match myargs.len() {
|
||||||
|
0 => &empty,
|
||||||
|
1 => &empty,
|
||||||
|
_ => &myargs[1..],
|
||||||
|
};
|
||||||
|
|
||||||
match func.as_executable() {
|
match func.as_executable() {
|
||||||
Some(exec) => exec.exec(avm, action_context, this, args),
|
Some(exec) => exec.exec(avm, action_context, this, args),
|
||||||
|
|
Loading…
Reference in New Issue