Check for obj validity with prop_object_type(), use xbps_pkg_has_rundeps().

This commit is contained in:
Juan RP 2011-10-31 09:48:46 +01:00
parent f35e1eff42
commit b8c804e891
2 changed files with 7 additions and 7 deletions

View File

@ -457,7 +457,7 @@ xbps_repository_find_pkg_deps(prop_dictionary_t transd,
assert(prop_object_type(repo_pkgd) == PROP_TYPE_DICTIONARY); assert(prop_object_type(repo_pkgd) == PROP_TYPE_DICTIONARY);
pkg_rdeps = prop_dictionary_get(repo_pkgd, "run_depends"); pkg_rdeps = prop_dictionary_get(repo_pkgd, "run_depends");
if (pkg_rdeps == NULL) if (prop_object_type(pkg_rdeps) != PROP_TYPE_ARRAY)
return 0; return 0;
prop_dictionary_get_cstring_nocopy(repo_pkgd, "pkgver", &pkgver); prop_dictionary_get_cstring_nocopy(repo_pkgd, "pkgver", &pkgver);

View File

@ -82,7 +82,6 @@ repository_find_pkg(const char *pattern, const char *reason)
} }
xbps_dbg_printf("%s: pattern %s reason %s\n", __func__, pattern, reason); xbps_dbg_printf("%s: pattern %s reason %s\n", __func__, pattern, reason);
/* /*
* Find out if the pkg has been found in repository pool. * Find out if the pkg has been found in repository pool.
*/ */
@ -117,10 +116,11 @@ repository_find_pkg(const char *pattern, const char *reason)
* Prepare required package dependencies and add them into the * Prepare required package dependencies and add them into the
* "unsorted" array in transaction dictionary. * "unsorted" array in transaction dictionary.
*/ */
if (xbps_pkg_has_rundeps(pkg_repod)) {
rv = xbps_repository_find_pkg_deps(transd, mdeps, pkg_repod); rv = xbps_repository_find_pkg_deps(transd, mdeps, pkg_repod);
if (rv != 0) if (rv != 0)
goto out; goto out;
}
/* /*
* Set package state in dictionary with same state than the * Set package state in dictionary with same state than the
* package currently uses, otherwise not-installed. * package currently uses, otherwise not-installed.
@ -169,7 +169,7 @@ repository_find_pkg(const char *pattern, const char *reason)
pkgver, repoloc); pkgver, repoloc);
out: out:
if (pkg_repod) if (prop_object_type(pkg_repod) == PROP_TYPE_DICTIONARY)
prop_object_release(pkg_repod); prop_object_release(pkg_repod);
return rv; return rv;