[gtk/improve-css-test-4.6: 3/4] css: Propagate charset conversion errors




commit ac18330f6581ebdce26f3d12642305ed279afe43
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Aug 11 07:17:55 2022 -0400

    css: Propagate charset conversion errors
    
    Lets not throw away informtation that
    helps to figure out why things fail.

 gtk/css/gtkcssdataurl.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gtk/css/gtkcssdataurl.c b/gtk/css/gtkcssdataurl.c
index 6645b4835d..6b9afb4834 100644
--- a/gtk/css/gtkcssdataurl.c
+++ b/gtk/css/gtkcssdataurl.c
@@ -152,13 +152,24 @@ gtk_css_data_url_parse (const char  *url,
       gsize read;
       gsize written;
       gpointer data;
+      GError *local_error = NULL;
 
       data = g_convert_with_fallback (bdata, bsize,
                                       "UTF-8", charset, 
                                       (char *) "*",
-                                      &read, &written, NULL);
+                                      &read, &written, &local_error);
       g_free (bdata);
 
+      if (local_error)
+        {
+          g_propagate_error (error, local_error);
+          g_free (charset);
+          g_free (data);
+          g_free (mimetype);
+          return NULL;
+        }
+
+
       bdata = data;
       bsize = written;
     }


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