[librsvg: 2/9] NodeTRef: log if the referenced element is nonexistent



commit ea1494302e2cda5eeffdd377dd3f3e6572dafb74
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Oct 24 11:33:07 2018 -0500

    NodeTRef: log if the referenced element is nonexistent

 rsvg_internals/src/text.rs | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 7017dbdb..2f0ff799 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -239,7 +239,7 @@ impl NodeTRef {
 
     fn measure(
         &self,
-        _node: &RsvgNode,
+        node: &RsvgNode,
         cascaded: &CascadedValues<'_>,
         draw_ctx: &mut DrawingCtx<'_>,
         length: &mut f64,
@@ -250,10 +250,17 @@ impl NodeTRef {
             return false;
         }
 
-        let done = if let Some(acquired) = draw_ctx.get_acquired_node(l.as_ref().unwrap()) {
+        let url = l.as_ref().unwrap();
+
+        let done = if let Some(acquired) = draw_ctx.get_acquired_node(url) {
             let c = acquired.get();
             measure_children(&c, cascaded, draw_ctx, length, true)
         } else {
+            rsvg_log!(
+                "element {} references a nonexistent text source \"{}\"",
+                node.get_human_readable_name(),
+                url,
+            );
             false
         };
 
@@ -262,7 +269,7 @@ impl NodeTRef {
 
     fn render(
         &self,
-        _node: &RsvgNode,
+        node: &RsvgNode,
         cascaded: &CascadedValues<'_>,
         draw_ctx: &mut DrawingCtx<'_>,
         x: &mut f64,
@@ -275,9 +282,17 @@ impl NodeTRef {
             return Ok(());
         }
 
-        if let Some(acquired) = draw_ctx.get_acquired_node(l.as_ref().unwrap()) {
+        let url = l.as_ref().unwrap();
+
+        if let Some(acquired) = draw_ctx.get_acquired_node(url) {
             let c = acquired.get();
             render_children(&c, cascaded, draw_ctx, x, y, true, clipping)?;
+        } else {
+            rsvg_log!(
+                "element {} references a nonexistent text source \"{}\"",
+                node.get_human_readable_name(),
+                url,
+            );
         }
 
         Ok(())


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