[gnome-control-center] user-account: don't segfault trying to get the user initials
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] user-account: don't segfault trying to get the user initials
- Date: Tue, 18 Aug 2020 22:28:52 +0000 (UTC)
commit 57b01cf6953b4e77b417c1b93dc1664d71a49878
Author: Sebastien Bacher <seb128 ubuntu com>
Date: Thu Aug 6 13:19:58 2020 +0200
user-account: don't segfault trying to get the user initials
it's possible that act_user_get_real_name returns null, handle that case
fixes bug #959
panels/user-accounts/user-utils.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/panels/user-accounts/user-utils.c b/panels/user-accounts/user-utils.c
index 6aba64f0e..3c17dfedd 100644
--- a/panels/user-accounts/user-utils.c
+++ b/panels/user-accounts/user-utils.c
@@ -588,6 +588,8 @@ extract_initials_from_name (const gchar *name)
gunichar unichar;
gpointer q = NULL;
+ g_return_val_if_fail (name != NULL, NULL);
+
p = g_utf8_strup (name, -1);
normalized = g_utf8_normalize (g_strstrip (p), -1, G_NORMALIZE_DEFAULT_COMPOSE);
if (normalized == NULL) {
@@ -744,10 +746,14 @@ set_user_icon_data (ActUser *user,
GdkPixbuf *
generate_default_avatar (ActUser *user, gint size)
{
+ const gchar *name;
GdkPixbuf *pixbuf = NULL;
cairo_surface_t *surface;
- surface = generate_user_picture (act_user_get_real_name (user), size);
+ name = act_user_get_real_name (user);
+ if (name == NULL)
+ name = "";
+ surface = generate_user_picture (name, size);
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, size, size);
cairo_surface_destroy (surface);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]