Log errors encountered when removing the children of a node we plan to parse XML into.

Also, remove a handful of unnecessary `#[allow(unused_must_use)]` instances.
This commit is contained in:
David Wendt 2020-01-05 00:04:45 -05:00
parent 464563a703
commit 14dba0d100
1 changed files with 5 additions and 6 deletions

View File

@ -184,7 +184,6 @@ pub fn xmlnode_has_child_nodes<'gc>(
} }
} }
#[allow(unused_must_use)]
pub fn xmlnode_remove_node<'gc>( pub fn xmlnode_remove_node<'gc>(
_avm: &mut Avm1<'gc>, _avm: &mut Avm1<'gc>,
ac: &mut UpdateContext<'_, 'gc, '_>, ac: &mut UpdateContext<'_, 'gc, '_>,
@ -202,7 +201,6 @@ pub fn xmlnode_remove_node<'gc>(
Ok(Value::Undefined.into()) Ok(Value::Undefined.into())
} }
#[allow(unused_must_use)]
pub fn xmlnode_to_string<'gc>( pub fn xmlnode_to_string<'gc>(
_avm: &mut Avm1<'gc>, _avm: &mut Avm1<'gc>,
_ac: &mut UpdateContext<'_, 'gc, '_>, _ac: &mut UpdateContext<'_, 'gc, '_>,
@ -611,7 +609,6 @@ pub fn xml_constructor<'gc>(
Ok(Value::Undefined.into()) Ok(Value::Undefined.into())
} }
#[allow(unused_must_use)]
pub fn xml_create_element<'gc>( pub fn xml_create_element<'gc>(
avm: &mut Avm1<'gc>, avm: &mut Avm1<'gc>,
ac: &mut UpdateContext<'_, 'gc, '_>, ac: &mut UpdateContext<'_, 'gc, '_>,
@ -640,7 +637,6 @@ pub fn xml_create_element<'gc>(
Ok(object.into()) Ok(object.into())
} }
#[allow(unused_must_use)]
pub fn xml_create_text_node<'gc>( pub fn xml_create_text_node<'gc>(
avm: &mut Avm1<'gc>, avm: &mut Avm1<'gc>,
ac: &mut UpdateContext<'_, 'gc, '_>, ac: &mut UpdateContext<'_, 'gc, '_>,
@ -669,7 +665,6 @@ pub fn xml_create_text_node<'gc>(
Ok(object.into()) Ok(object.into())
} }
#[allow(unused_must_use)]
pub fn xml_parse_xml<'gc>( pub fn xml_parse_xml<'gc>(
avm: &mut Avm1<'gc>, avm: &mut Avm1<'gc>,
ac: &mut UpdateContext<'_, 'gc, '_>, ac: &mut UpdateContext<'_, 'gc, '_>,
@ -686,7 +681,11 @@ pub fn xml_parse_xml<'gc>(
if let Some(children) = node.children() { if let Some(children) = node.children() {
for child in children.rev() { for child in children.rev() {
node.remove_child(ac.gc_context, child); let result = node.remove_child(ac.gc_context, child);
if let Err(e) = result {
log::warn!("XML.parseXML: Error removing node contents: {}", e);
return Ok(Value::Undefined.into());
}
} }
} }