network: fix crashes in eap-method-simple

When the stored password is missing, we will crash passing NULL to a
non-nullable GTK API function.

Fixes #1905
This commit is contained in:
Michael Catanzaro 2022-10-21 10:23:01 -05:00 committed by Felipe Borges
parent 5ba50dec58
commit db3be4c498

View file

@ -200,7 +200,8 @@ static void
set_username (EAPMethod *method, const gchar *username)
{
EAPMethodSimple *self = EAP_METHOD_SIMPLE (method);
gtk_editable_set_text (GTK_EDITABLE (self->username_entry), username);
if (username)
gtk_editable_set_text (GTK_EDITABLE (self->username_entry), username);
}
static const gchar *
@ -214,7 +215,8 @@ static void
set_password (EAPMethod *method, const gchar *password)
{
EAPMethodSimple *self = EAP_METHOD_SIMPLE (method);
gtk_editable_set_text (GTK_EDITABLE (self->password_entry), password);
if (password)
gtk_editable_set_text (GTK_EDITABLE (self->password_entry), password);
}
static gboolean