[gobject-introspection] girepository: Fix NULL return from g_irepository_get_dependencies()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] girepository: Fix NULL return from g_irepository_get_dependencies()
- Date: Mon, 16 Feb 2015 08:49:01 +0000 (UTC)
commit c74a18a0183f80d8ae97208de3ae657186ad4cd8
Author: Philip Withnall <philip tecnocode co uk>
Date: Sat Jan 31 22:22:16 2015 +0000
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
girepository/girepository.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/girepository/girepository.c b/girepository/girepository.c
index 931385f..fb91afa 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -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;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]