From 7af7ef40c98c9df256bc3d015777b334948aa634 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 22 Nov 2009 21:51:19 +0100 Subject: [PATCH] xbps_get_pkgver_from_dict: return NULL if the object is not there. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091122205119-ezkdj0sdju2ezoum --- lib/util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/util.c b/lib/util.c index 69feecad..907f77e8 100644 --- a/lib/util.c +++ b/lib/util.c @@ -148,12 +148,13 @@ xbps_check_is_installed_pkg(const char *pkg) } free(pkgname); + /* Check if installed pkg is matched against pkgdep pattern */ instpkgver = xbps_get_pkgver_from_dict(dict); if (instpkgver == NULL) { prop_object_release(dict); return -1; } - /* Check if installed pkg is matched against pkgdep pattern */ + rv = xbps_pkgdep_match(instpkgver, __UNCONST(pkg)); prop_object_release(dict); @@ -273,7 +274,9 @@ xbps_get_pkgver_from_dict(prop_dictionary_t d) assert(d != NULL); - prop_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver); + if (!prop_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver)) + return NULL; + return pkgver; }