[librsvg] Log invalid declarations when parsing the style attribute



commit 1b4565b51c38ff3b0119e74977ade38f4d63148d
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jan 14 13:25:22 2020 -0600

    Log invalid declarations when parsing the style attribute

 rsvg_internals/src/properties.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/properties.rs b/rsvg_internals/src/properties.rs
index 41f4a924..89e6a48d 100644
--- a/rsvg_internals/src/properties.rs
+++ b/rsvg_internals/src/properties.rs
@@ -657,7 +657,13 @@ impl SpecifiedValues {
         let mut parser = Parser::new(&mut input);
 
         DeclarationListParser::new(&mut parser, DeclParser)
-            .filter_map(Result::ok) // ignore invalid property name or value
+            .filter_map(|r| match r {
+                Ok(decl) => Some(decl),
+                Err(e) => {
+                    rsvg_log!("Invalid declaration; ignoring: {:?}", e);
+                    None
+                }
+            })
             .for_each(|decl| self.set_property_from_declaration(&decl, important_styles));
 
         Ok(())


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