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




commit 4d4e18bc47ef83fe023574948d880da952068bcc
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]