[librsvg/wip/aruiz/rust-pixbuf-loader] pixbuf-loader: check if **GError is null



commit 4154d9d9f0a5ca0b19ba8a214936a63875d41e83
Author: Alberto Ruiz <aruiz redhat com>
Date:   Mon Aug 8 13:31:58 2022 +0100

    pixbuf-loader: check if **GError is null

 gdk-pixbuf-loader/src/lib.rs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gdk-pixbuf-loader/src/lib.rs b/gdk-pixbuf-loader/src/lib.rs
index 839b79508..fdb765d6f 100644
--- a/gdk-pixbuf-loader/src/lib.rs
+++ b/gdk-pixbuf-loader/src/lib.rs
@@ -115,8 +115,10 @@ unsafe extern "C" fn stop_load(user_data: glib_sys::gpointer, error: *mut *mut G
     let pixbuf = match _inner_stop_load(&ctx) {
         Ok(r) => r,
         Err(e) => {
-            let gerr = glib::Error::new(gdk_pixbuf::PixbufError::Failed, &e);
-            *error = gerr.to_glib_full() as *mut GError;
+            if error != null_mut() {
+                let gerr = glib::Error::new(gdk_pixbuf::PixbufError::Failed, &e);
+                *error = gerr.to_glib_full() as *mut GError;
+            }
             return false.into_glib();
         }
     };


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