[librsvg: 12/38] rsvg_handle_rust_get_pixbuf_sub(): Move the loaded check to the helper function



commit d8df69338257310cd52eff8eeaa076dc25f5115d
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jan 22 18:50:17 2019 -0600

    rsvg_handle_rust_get_pixbuf_sub(): Move the loaded check to the helper function

 rsvg_internals/src/handle.rs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index 8152cb1a..a5b14dde 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -909,6 +909,8 @@ pub unsafe extern "C" fn rsvg_handle_rust_render_cairo_sub(
 }
 
 fn get_pixbuf_sub(handle: &mut Handle, id: Option<&str>) -> Result<Pixbuf, RenderingError> {
+    handle.check_is_loaded()?;
+
     let dimensions = handle.get_dimensions()?;
 
     let surface = ImageSurface::create(cairo::Format::ARgb32, dimensions.width, dimensions.height)?;
@@ -931,10 +933,6 @@ pub unsafe extern "C" fn rsvg_handle_rust_get_pixbuf_sub(
     let rhandle = get_rust_handle(handle);
     let id: Option<String> = from_glib_none(id);
 
-    if rhandle.check_is_loaded().is_err() {
-        return ptr::null_mut();
-    }
-
     match get_pixbuf_sub(rhandle, id.as_ref().map(String::as_str)) {
         Ok(pixbuf) => pixbuf.to_glib_full(),
         Err(_) => ptr::null_mut(),


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