[librsvg/librsvg-2.50] (#703): Ignore elements in an error state inside the <switch> element



commit 0f09aa73e4db1edafaf0f30eea58884063f5ff65
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Mar 30 13:35:24 2021 -0600

    (#703): Ignore elements in an error state inside the <switch> element
    
    It turns out that the implementation for <switch> needs to be aware of
    elements that have been set in an error state while parsing their
    attributes.  For example, getting an error while parsing
    `systemLanguage` for an element inside a <switch> should cause *that*
    element to be ignored while picking which of `<switch>`'s children to
    render.
    
    Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/703

 rsvg_internals/src/structure.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index d22e7dab..92c4fea6 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -72,7 +72,10 @@ impl Draw for Switch {
             if let Some(child) = node
                 .children()
                 .filter(|c| c.is_element())
-                .find(|c| c.borrow_element().get_cond())
+                .find(|c| {
+                    let elt = c.borrow_element();
+                    elt.get_cond() && !elt.is_in_error()
+                })
             {
                 dc.draw_node_from_stack(
                     &child,


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