mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 17:56:17 +01:00
girepository: avoids segfault in case of bad gtype
If a <GType invalid> (that's the way it appears in python's debugger) is returned, `g_type_name` returns NULL. This function therefore returns NULL at this time as subsequent calls to `strlen( data->gtype_name)` segfault.
This commit is contained in:
parent
3d999b47e5
commit
6583ad7f4f
@ -806,12 +806,14 @@ find_by_gtype (GHashTable *table, FindByGTypeData *data, gboolean check_prefix)
|
|||||||
*/
|
*/
|
||||||
GIBaseInfo *
|
GIBaseInfo *
|
||||||
g_irepository_find_by_gtype (GIRepository *repository,
|
g_irepository_find_by_gtype (GIRepository *repository,
|
||||||
GType gtype)
|
GType gtype)
|
||||||
{
|
{
|
||||||
FindByGTypeData data;
|
FindByGTypeData data;
|
||||||
GIBaseInfo *cached;
|
GIBaseInfo *cached;
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gtype != G_TYPE_INVALID, NULL);
|
||||||
|
|
||||||
repository = get_repository (repository);
|
repository = get_repository (repository);
|
||||||
|
|
||||||
cached = g_hash_table_lookup (repository->priv->info_by_gtype,
|
cached = g_hash_table_lookup (repository->priv->info_by_gtype,
|
||||||
|
Loading…
Reference in New Issue
Block a user