[librsvg] rsvg_handle_get_position_sub(): test for the presence of a toplevel node as soon as possible



commit 7e5384590b8ff1a6d5d693365059165adf60330f
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Aug 11 18:55:17 2017 -0500

    rsvg_handle_get_position_sub(): test for the presence of a toplevel node as soon as possible

 rsvg-base.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index d38a385..e821d8d 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -1623,6 +1623,9 @@ rsvg_handle_get_position_sub (RsvgHandle * handle, RsvgPositionData * position_d
     g_return_val_if_fail (handle, FALSE);
     g_return_val_if_fail (position_data, FALSE);
 
+    if (!handle->priv->treebase)
+        return FALSE;
+
     /* Short-cut when no id is given. */
     if (NULL == id || '\0' == *id) {
         position_data->x = 0;
@@ -1643,9 +1646,6 @@ rsvg_handle_get_position_sub (RsvgHandle * handle, RsvgPositionData * position_d
         return TRUE;
     }
 
-    if (!handle->priv->treebase)
-        return FALSE;
-
     target = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
     cr = cairo_create  (target);
     draw = rsvg_cairo_new_drawing_ctx (cr, handle);


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