From 96a726f20bcaaf4f66825b1a0584fba223b0e0a9 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 7 Dec 2010 15:13:46 +0000 Subject: [PATCH] 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 file changed, 3 insertions(+), 6 deletions(-) diff --git a/panels/user-accounts/um-password-dialog.c b/panels/user-accounts/um-password-dialog.c index 1e4aaa652..1cdb30106 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); }