[epiphany/wip/sync] password-manager: Fix crash when trying to cache NULL usernames
- From: Gabriel Ivașcu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/sync] password-manager: Fix crash when trying to cache NULL usernames
- Date: Sun, 30 Jul 2017 01:07:27 +0000 (UTC)
commit ab24b1fd83354ef6ab475c1287d276994263d174
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Sun Jul 30 04:06:48 2017 +0300
password-manager: Fix crash when trying to cache NULL usernames
lib/sync/ephy-password-manager.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/lib/sync/ephy-password-manager.c b/lib/sync/ephy-password-manager.c
index 48050b6..ea48dbb 100644
--- a/lib/sync/ephy-password-manager.c
+++ b/lib/sync/ephy-password-manager.c
@@ -290,7 +290,8 @@ populate_cache_cb (GSList *records,
const char *hostname = ephy_password_record_get_hostname (record);
const char *username = ephy_password_record_get_username (record);
- ephy_password_manager_cache_add (self, hostname, username);
+ if (username)
+ ephy_password_manager_cache_add (self, hostname, username);
}
g_slist_free_full (records, g_object_unref);
@@ -416,20 +417,24 @@ ephy_password_manger_store_record (EphyPasswordManager *self,
EphyPasswordRecord *record)
{
GHashTable *attributes;
+ const char *hostname;
+ const char *username;
g_assert (EPHY_IS_PASSWORD_MANAGER (self));
g_assert (EPHY_IS_PASSWORD_RECORD (record));
+ hostname = ephy_password_record_get_hostname (record);
+ username = ephy_password_record_get_username (record);
attributes = get_attributes_table (ephy_password_record_get_id (record),
- ephy_password_record_get_hostname (record),
- ephy_password_record_get_username (record),
+ hostname,
+ username,
ephy_password_record_get_username_field (record),
ephy_password_record_get_password_field (record),
ephy_synchronizable_get_server_time_modified (EPHY_SYNCHRONIZABLE
(record)));
store_internal (ephy_password_record_get_password (record), attributes, NULL, NULL);
- ephy_password_manager_cache_add (self,
- ephy_password_record_get_hostname (record),
- ephy_password_record_get_username (record));
+
+ if (username)
+ ephy_password_manager_cache_add (self, hostname, username);
g_hash_table_unref (attributes);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]