[gnome-control-center] user-accounts: Don't crash when apg is missing



commit 96a726f20bcaaf4f66825b1a0584fba223b0e0a9
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Dec 7 15:13:46 2010 +0000

    user-accounts: Don't crash when apg is missing
    
    https://bugzilla.gnome.org/show_bug.cgi?id=635808

 panels/user-accounts/um-password-dialog.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/panels/user-accounts/um-password-dialog.c b/panels/user-accounts/um-password-dialog.c
index 1e4aaa6..1cdb301 100644
--- a/panels/user-accounts/um-password-dialog.c
+++ b/panels/user-accounts/um-password-dialog.c
@@ -132,7 +132,6 @@ generate_passwords (UmPasswordDialog *um)
         gchar *output, *err, *cmdline;
         gint status;
         GError *error;
-        gchar **lines;
         gint i;
         GtkWidget *item;
 
@@ -154,9 +153,8 @@ generate_passwords (UmPasswordDialog *um)
         if (!g_spawn_command_line_sync (cmdline, &output, &err, &status, &error)) {
                 g_warning ("Failed to run apg: %s", error->message);
                 g_error_free (error);
-        }
-
-        if (WEXITSTATUS (status) == 0) {
+        } else if (WEXITSTATUS (status) == 0) {
+                char **lines;
                 lines = g_strsplit (output, "\n", 0);
                 for (i = 0; lines[i]; i++) {
                         if (lines[i][0] == 0)
@@ -169,8 +167,7 @@ generate_passwords (UmPasswordDialog *um)
                         gtk_menu_shell_append (GTK_MENU_SHELL (um->generate_menu), item);
                 }
                 g_strfreev (lines);
-        }
-        else {
+        } else {
                 g_warning ("agp returned an error: %s", err);
         }
 



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