From 60def049d95e82c836cfc8b2f13a4ed8472f7865 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 20 Sep 2010 17:56:30 +0100 Subject: [PATCH] =?utf8?q?Bug=20630185=20=E2=80=94=20Allow=20NULL=20string?= =?utf8?q?s=20in=20g=5Fquark=5Ftry=5Fstring()?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Allow NULL strings to be passed to g_quark_try_string(), returning a 0 quark in that case, as per the existing documentation. Closes: bgo#630185 --- glib/gdataset.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/glib/gdataset.c b/glib/gdataset.c index 9a3e8f9..cd3a51e 100644 --- a/glib/gdataset.c +++ b/glib/gdataset.c @@ -1000,8 +1000,10 @@ GQuark g_quark_try_string (const gchar *string) { GQuark quark = 0; - g_return_val_if_fail (string != NULL, 0); - + + if (string == NULL) + return 0; + G_LOCK (g_quark_global); if (g_quark_ht) quark = GPOINTER_TO_UINT (g_hash_table_lookup (g_quark_ht, string)); -- 2.7.4