Re: Null check in g_hash_table_lookup()
- Date: Sat, 15 Aug 2015 14:14:22 -0700
- From: "Jasper St. Pierre" <jstpierre@xxxxxxxxxxx>
- Subject: Re: Null check in g_hash_table_lookup()
It will fix it in that it will warn and then return NULL (and only if
you build glib with the flag that turns those return_val_if_fail's on,
which it does by default), but it's considered improper behavior to
call g_hash_table_lookup with a NULL key.
On Sat, Aug 15, 2015 at 1:27 PM, Michael McConville
> Currently, if you pass a null key pointer to g_hash_table_lookup(), it
> will sometimes segfault in g_str_hash(). This often happened in the
> Pidgin development tip until we added this check:
> I was running GLib 2.44.1 on OpenBSD 5.8 (-current).
> It seems like adding:
> g_return_val_if_fail (key != NULL, NULL);
> Should fix it. However, it seems saliently missing, so maybe I'm
> misunderstanding and NULL can be a valid key pointer.
> gtk-devel-list mailing list
gtk-devel-list mailing list