[xdg-desktop-portal-gnome/wip/rishi/coverity-fixes-01: 3/4] wallpaperdialog: Handle the error when storing an image in the cache




commit cadb905d9053b599901b6de1909eb94e1db487e6
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Jul 2 17:41:12 2022 +0200

    wallpaperdialog: Handle the error when storing an image in the cache

 src/wallpaperdialog.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/wallpaperdialog.c b/src/wallpaperdialog.c
index cd34b9c..75fc17a 100644
--- a/src/wallpaperdialog.c
+++ b/src/wallpaperdialog.c
@@ -133,7 +133,11 @@ on_image_loaded_cb (GObject *source_object,
       return;
     }
 
-  g_file_replace_contents (tmp, contents, length, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, 
NULL, &error);
+  if (!g_file_replace_contents (tmp, contents, length, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, 
NULL, &error))
+    {
+      g_warning ("Failed to store image: %s", error->message);
+      return;
+    }
 
   self->picture_uri = g_file_get_uri (tmp);
   wallpaper_preview_set_image (self->desktop_preview,


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