From 5d9c73cbb136ec3a73e7caaa92291b56f88b72ea Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sat, 12 Aug 2023 12:49:28 +0200 Subject: [PATCH] core: to_xml_string is now infallible --- core/src/avm2/e4x.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/avm2/e4x.rs b/core/src/avm2/e4x.rs index 9f8f29331..f0b75bece 100644 --- a/core/src/avm2/e4x.rs +++ b/core/src/avm2/e4x.rs @@ -647,7 +647,7 @@ impl<'gc> E4XNode<'gc> { ); } - return to_xml_string(E4XOrXml::E4X(*self), activation); + return Ok(to_xml_string(E4XOrXml::E4X(*self), activation)); } other => Err(format!("XML.toString(): Not yet implemented for {other:?}").into()), } @@ -657,7 +657,7 @@ impl<'gc> E4XNode<'gc> { &self, activation: &mut Activation<'_, 'gc>, ) -> Result, Error<'gc>> { - return to_xml_string(E4XOrXml::E4X(*self), activation); + return Ok(to_xml_string(E4XOrXml::E4X(*self), activation)); } pub fn kind(&self) -> Ref<'_, E4XNodeKind<'gc>> { @@ -806,10 +806,10 @@ fn to_xml_string_inner(xml: E4XOrXml, buf: &mut WString) { pub fn to_xml_string<'gc>( xml: E4XOrXml<'gc>, activation: &mut Activation<'_, 'gc>, -) -> Result, Error<'gc>> { +) -> AvmString<'gc> { let mut buf = WString::new(); to_xml_string_inner(xml, &mut buf); - Ok(AvmString::new(activation.context.gc_context, buf)) + AvmString::new(activation.context.gc_context, buf) } pub fn name_to_multiname<'gc>(