diff --git a/core/src/avm2/amf.rs b/core/src/avm2/amf.rs index ffe9d534b..c96714fde 100644 --- a/core/src/avm2/amf.rs +++ b/core/src/avm2/amf.rs @@ -112,10 +112,7 @@ pub fn serialize_value<'gc>( } else if let Some(xml) = o.as_xml_object() { // `is_string` is `true` for the AS3 XML class Some(AmfValue::XML( - xml.node() - .xml_to_xml_string(activation) - .expect("Failed to stringify XML") - .to_string(), + xml.node().xml_to_xml_string(activation).to_string(), true, )) } else if let Some(bytearray) = o.as_bytearray() { diff --git a/core/src/avm2/e4x.rs b/core/src/avm2/e4x.rs index f0b75bece..fcd6cf805 100644 --- a/core/src/avm2/e4x.rs +++ b/core/src/avm2/e4x.rs @@ -653,11 +653,8 @@ impl<'gc> E4XNode<'gc> { } } - pub fn xml_to_xml_string( - &self, - activation: &mut Activation<'_, 'gc>, - ) -> Result, Error<'gc>> { - return Ok(to_xml_string(E4XOrXml::E4X(*self), activation)); + pub fn xml_to_xml_string(&self, activation: &mut Activation<'_, 'gc>) -> AvmString<'gc> { + return to_xml_string(E4XOrXml::E4X(*self), activation); } pub fn kind(&self) -> Ref<'_, E4XNodeKind<'gc>> { diff --git a/core/src/avm2/globals/xml.rs b/core/src/avm2/globals/xml.rs index 0d23e16c9..758838090 100644 --- a/core/src/avm2/globals/xml.rs +++ b/core/src/avm2/globals/xml.rs @@ -118,7 +118,7 @@ pub fn to_xml_string<'gc>( ) -> Result, Error<'gc>> { let xml = this.as_xml_object().unwrap(); let node = xml.node(); - Ok(Value::String(node.xml_to_xml_string(activation)?)) + Ok(Value::String(node.xml_to_xml_string(activation))) } pub fn child<'gc>( diff --git a/core/src/avm2/globals/xml_list.rs b/core/src/avm2/globals/xml_list.rs index d81b1f0e8..7410e82a6 100644 --- a/core/src/avm2/globals/xml_list.rs +++ b/core/src/avm2/globals/xml_list.rs @@ -142,7 +142,7 @@ pub fn to_xml_string<'gc>( if i != 0 { out.push_char('\n'); } - out.push_str(child.node().xml_to_xml_string(activation)?.as_wstr()) + out.push_str(child.node().xml_to_xml_string(activation).as_wstr()) } Ok(AvmString::new(activation.context.gc_context, out).into()) }