From 1c2fc2096410fd1530ba7f3c60a04ea038555d06 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 24 Nov 2009 03:01:32 +0000 Subject: [PATCH] xbps_find_pkg_in_dict: return NULL if pkgname obj is not there. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091124030132-m2wgi7p38voah0ol --- lib/plist.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/plist.c b/lib/plist.c index aa121137..13951a8d 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -230,7 +230,11 @@ xbps_find_pkg_in_dict(prop_dictionary_t dict, const char *key, return NULL; while ((obj = prop_object_iterator_next(iter))) { - prop_dictionary_get_cstring_nocopy(obj, "pkgname", &dpkgn); + if (!prop_dictionary_get_cstring_nocopy(obj, + "pkgname", &dpkgn)) { + obj = NULL; + break; + } if (strcmp(dpkgn, pkgname) == 0) break; }