summaryrefslogtreecommitdiff
path: root/girepository/girepository.c
diff options
context:
space:
mode:
authorSteve Frécinaux <code@istique.net>2010-08-18 22:26:48 +0200
committerSteve Frécinaux <code@istique.net>2010-08-18 22:45:19 +0200
commit7e75df29383e0284648d25532bf4e90eb2879674 (patch)
tree1c2348e3b91adf0e17b70193513a35cdfbec2a9c /girepository/girepository.c
parent3ed944ed5f7a8231ba5c431d59e33f23dca56f87 (diff)
downloadgobject-introspection-7e75df29383e0284648d25532bf4e90eb2879674.tar.gz
Fix warning when using g_irepository_enumerate_version()
The reason for the warning was that g_irepository_get_version() expects the typelib to be already loaded, but enumerate_version() can be called on typelibs that are not.
Diffstat (limited to 'girepository/girepository.c')
-rw-r--r--girepository/girepository.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/girepository/girepository.c b/girepository/girepository.c
index 96a23e6f..288055ce 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -1196,9 +1196,12 @@ g_irepository_enumerate_versions (GIRepository *repository,
* available versions, as it could have been loaded using
* require_private().
*/
- loaded_version = g_irepository_get_version (NULL, namespace_);
- if (loaded_version && !g_list_find_custom (ret, loaded_version, g_str_equal))
- ret = g_list_prepend (ret, g_strdup (loaded_version));
+ if (g_irepository_is_registered (repository, namespace_, NULL))
+ {
+ loaded_version = g_irepository_get_version (repository, namespace_);
+ if (loaded_version && !g_list_find_custom (ret, loaded_version, g_str_equal))
+ ret = g_list_prepend (ret, g_strdup (loaded_version));
+ }
return ret;
}