[librsvg] Handle.set_base_url() - Move the load_state check to here



commit b3c9a875363f7e5d86aaf6a6e210d4520673eab6
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jan 8 17:25:10 2019 -0600

    Handle.set_base_url() - Move the load_state check to here

 rsvg_internals/src/handle.rs | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index c835cf8b..e2e33821 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -168,6 +168,13 @@ impl Handle {
     }
 
     fn set_base_url(&self, url: &str) {
+        if self.load_state.get() != LoadState::Start {
+            rsvg_g_warning(
+                "Please set the base file or URI before loading any data into RsvgHandle",
+            );
+            return;
+        }
+
         match Url::parse(&url) {
             Ok(u) => {
                 let url_cstring = CString::new(u.as_str()).unwrap();
@@ -726,11 +733,6 @@ pub unsafe extern "C" fn rsvg_handle_rust_set_base_url(
 ) {
     let handle = &*raw_handle;
 
-    if handle.load_state.get() != LoadState::Start {
-        rsvg_g_warning("Please set the base file or URI before loading any data into RsvgHandle");
-        return;
-    }
-
     assert!(!uri.is_null());
     let uri: String = from_glib_none(uri);
 


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