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
This commit is contained in:
Cosimo Cecchi 2019-05-26 10:16:03 -07:00 committed by Bastien Nocera
parent 80cf412e83
commit b118c874da

View File

@ -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 lenght at most */
stripped_label = temp = g_new (gchar, strlen(label) + 1);