[librsvg] (#377): xml.rs: ignore character data outside the toplevel XML element



commit 31e5a41ce93535a727754101a62d3e77c552b7d0
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Nov 20 10:57:52 2018 -0600

    (#377): xml.rs: ignore character data outside the toplevel XML element
    
    I'm not 100% sure why libxml2 would hand us character data outside the
    toplevel element (shouldn't that be ignorable whitespace, or invalid
    XML?), but the original implementation explicitly ignored it, so let's
    do the same.
    
    Should fix https://gitlab.gnome.org/GNOME/librsvg/issues/377

 rsvg_internals/src/xml.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index c7729123..3639907c 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -140,7 +140,7 @@ impl XmlState {
         let ctx = mem::replace(&mut self.context, Context::empty());
 
         match ctx.kind {
-            ContextKind::Start => panic!("characters: XML handler stack is empty!?"),
+            ContextKind::Start => (), // character data outside the toplevel element?  Ignore it.
             ContextKind::ElementCreation => self.element_creation_characters(text),
             ContextKind::XInclude(_) => (),
             ContextKind::UnsupportedXIncludeChild => (),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]