avm2: Don't except when dispatching events on unconstructed objects.

This commit is contained in:
David Wendt 2021-02-04 19:53:50 -05:00 committed by Mike Welsh
parent 50546512fe
commit a2d56016cb
1 changed files with 8 additions and 1 deletions

View File

@ -381,7 +381,14 @@ pub fn dispatch_event_to_target<'gc>(
&QName::new(Namespace::private(NS_EVENT_DISPATCHER), "dispatch_list"), &QName::new(Namespace::private(NS_EVENT_DISPATCHER), "dispatch_list"),
activation, activation,
)? )?
.coerce_to_object(activation)?; .coerce_to_object(activation);
if dispatch_list.is_err() {
// Objects with no dispatch list act as if they had an empty one
return Ok(());
}
let dispatch_list = dispatch_list.unwrap();
let mut evtmut = event.as_event_mut(activation.context.gc_context).unwrap(); let mut evtmut = event.as_event_mut(activation.context.gc_context).unwrap();
let name = evtmut.event_type(); let name = evtmut.event_type();