[gnome-panel] launcher: check return values



commit 18106e8cde56d072def2c49b980e893b682ab882
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Mar 21 14:44:42 2021 +0200

    launcher: check return values
    
    Coverity CID: #1502698, #1502706

 modules/launcher/gp-launcher-applet.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/modules/launcher/gp-launcher-applet.c b/modules/launcher/gp-launcher-applet.c
index 54854b6ec..553ff7b7c 100644
--- a/modules/launcher/gp-launcher-applet.c
+++ b/modules/launcher/gp-launcher-applet.c
@@ -998,14 +998,12 @@ update_launcher (GpLauncherApplet *self)
   priv = gp_launcher_applet_get_instance_private (self);
 
   error = NULL;
-  g_key_file_load_from_file (priv->key_file,
-                             priv->location,
-                             G_KEY_FILE_NONE,
-                             &error);
-
   error_message = NULL;
 
-  if (error != NULL)
+  if (!g_key_file_load_from_file (priv->key_file,
+                                  priv->location,
+                                  G_KEY_FILE_NONE,
+                                  &error))
     {
       error_message = g_strdup_printf (_("Failed to load key file “%s”: %s"),
                                        priv->location,
@@ -1415,10 +1413,7 @@ gp_launcher_applet_initial_setup (GpApplet *applet,
       filename = gp_launcher_get_unique_filename ();
 
       error = NULL;
-      g_key_file_save_to_file (file, filename, &error);
-      g_key_file_unref (file);
-
-      if (error != NULL)
+      if (!g_key_file_save_to_file (file, filename, &error))
         {
           g_warning ("%s", error->message);
           g_error_free (error);
@@ -1432,6 +1427,7 @@ gp_launcher_applet_initial_setup (GpApplet *applet,
           g_free (basename);
         }
 
+      g_key_file_unref (file);
       g_free (filename);
     }
 


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