[gnome-control-center/wip/oholy/add-user-segfaults] user-accounts: Fix crashes when dialog is canceled



commit 587238867e37d9b614ffdc945a61264827f430dd
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Feb 8 09:45:35 2019 +0100

    user-accounts: Fix crashes when dialog is canceled
    
    Changes from !373 causes crashes when "Add User" dialog is canceled.
    Check return value and generate user avatar only if valid user is
    returned to fix the crashes.

 panels/user-accounts/cc-user-panel.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c
index f71e83b1a..8edb5a594 100644
--- a/panels/user-accounts/cc-user-panel.c
+++ b/panels/user-accounts/cc-user-panel.c
@@ -365,9 +365,10 @@ add_user (CcUserPanel *self)
         gtk_dialog_run (GTK_DIALOG (dialog));
 
         user = cc_add_user_dialog_get_user (dialog);
-        generate_user_avatar (user);
-        if (user != NULL)
+        if (user != NULL) {
+                generate_user_avatar (user);
                 reload_users (self, user);
+        }
 
         gtk_widget_destroy (GTK_WIDGET (dialog));
 }


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