mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
girepository: Fix NULL return from g_irepository_get_dependencies()
If a typelib had no dependencies, g_irepository_get_dependencies() would return NULL, rather than an empty NULL-terminated vector. https://bugzilla.gnome.org/show_bug.cgi?id=743782
This commit is contained in:
parent
2825bd2edc
commit
3128c1e9a5
@ -253,6 +253,8 @@ build_typelib_key (const char *name, const char *source)
|
||||
return g_string_free (str, FALSE);
|
||||
}
|
||||
|
||||
/* Note: Returns %NULL (not an empty %NULL-terminated array) if there are no
|
||||
* dependencies. */
|
||||
static char **
|
||||
get_typelib_dependencies (GITypelib *typelib)
|
||||
{
|
||||
@ -450,6 +452,7 @@ g_irepository_get_dependencies (GIRepository *repository,
|
||||
const char *namespace)
|
||||
{
|
||||
GITypelib *typelib;
|
||||
gchar **deps;
|
||||
|
||||
g_return_val_if_fail (namespace != NULL, NULL);
|
||||
|
||||
@ -458,7 +461,12 @@ g_irepository_get_dependencies (GIRepository *repository,
|
||||
typelib = get_registered (repository, namespace, NULL);
|
||||
g_return_val_if_fail (typelib != NULL, NULL);
|
||||
|
||||
return get_typelib_dependencies (typelib);
|
||||
/* Ensure we always return a non-%NULL vector. */
|
||||
deps = get_typelib_dependencies (typelib);
|
||||
if (deps == NULL)
|
||||
deps = g_strsplit ("", "|", 0);
|
||||
|
||||
return deps;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user