From 2c45b5416eb3283453d56ccbc331a53b746862c5 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sun, 26 May 2019 10:16:03 -0700 Subject: [PATCH] keyring-prompt: relax NULL check in remove_mnemonics() Instead of considering a GValue containing a NULL string to be a programmer error, simply return NULL. remove_mnemonics() is in fact called on the value of the "choice-label" property as well, which has NULL as its default value. This prevents triggering the following gnome-shell warning: gnome-shell[1082]: remove_mnemonics: assertion 'label != NULL' failed https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/555 --- src/shell-keyring-prompt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shell-keyring-prompt.c b/src/shell-keyring-prompt.c index 1a8cb3ba0..092c19ac5 100644 --- a/src/shell-keyring-prompt.c +++ b/src/shell-keyring-prompt.c @@ -115,7 +115,8 @@ remove_mnemonics (const GValue *value) g_return_val_if_fail (G_VALUE_HOLDS_STRING (value), NULL); label = g_value_get_string (value); - g_return_val_if_fail (label != NULL, NULL); + if (!label) + return NULL; /* Stripped label will have the original label length at most */ stripped_label = temp = g_new (gchar, strlen(label) + 1);