xbps_get_pkgver_from_dict: return NULL if the object is not there.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091122205119-ezkdj0sdju2ezoum
This commit is contained in:
Juan RP 2009-11-22 21:51:19 +01:00
parent a3dca717ae
commit 7af7ef40c9

View File

@ -148,12 +148,13 @@ xbps_check_is_installed_pkg(const char *pkg)
} }
free(pkgname); free(pkgname);
/* Check if installed pkg is matched against pkgdep pattern */
instpkgver = xbps_get_pkgver_from_dict(dict); instpkgver = xbps_get_pkgver_from_dict(dict);
if (instpkgver == NULL) { if (instpkgver == NULL) {
prop_object_release(dict); prop_object_release(dict);
return -1; return -1;
} }
/* Check if installed pkg is matched against pkgdep pattern */
rv = xbps_pkgdep_match(instpkgver, __UNCONST(pkg)); rv = xbps_pkgdep_match(instpkgver, __UNCONST(pkg));
prop_object_release(dict); prop_object_release(dict);
@ -273,7 +274,9 @@ xbps_get_pkgver_from_dict(prop_dictionary_t d)
assert(d != NULL); assert(d != NULL);
prop_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver); if (!prop_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver))
return NULL;
return pkgver; return pkgver;
} }