[gnome-shell/gnome-3-32] keyring-prompt: relax NULL check in remove_mnemonics()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-32] keyring-prompt: relax NULL check in remove_mnemonics()
- Date: Wed, 17 Jul 2019 14:17:39 +0000 (UTC)
commit b118c874da74fd0ae9aba8261b86a02f0cdede9b
Author: Cosimo Cecchi <cosimo endlessm com>
Date: Sun May 26 10:16:03 2019 -0700
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 7ab061c67..0a72340c3 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 lenght at most */
stripped_label = temp = g_new (gchar, strlen(label) + 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]