Skip to content

Commit

Permalink
avm2: Do not panic in XMLList call handler
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepycatcoding authored and Dinnerbone committed Oct 19, 2023
1 parent 8021efa commit 8b5b135
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions core/src/avm2/globals/xml_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,15 @@ pub fn call_handler<'gc>(
_this: Object<'gc>,
args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> {
// We do *not* create a new object when AS does 'XMLList(someXMLList)'
if let Some(obj) = args.try_get_object(activation, 0) {
if let Some(xml_list) = obj.as_xml_list_object() {
return Ok(xml_list.into());
if args.len() == 1 {
// We do *not* create a new object when AS does 'XMLList(someXMLList)'
if let Some(obj) = args.try_get_object(activation, 0) {
if let Some(xml_list) = obj.as_xml_list_object() {
return Ok(xml_list.into());
}
}
}

Ok(activation
.avm2()
.classes()
Expand Down

0 comments on commit 8b5b135

Please sign in to comment.