From 692caea1cd08ab1d4c089c4a7bd28176762ba94e Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Wed, 2 Feb 2011 09:53:56 +0100
Subject: [PATCH] xbps_get_pkg_state_*: if state object is not available return
 EINVAL.

---
 lib/package_state.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/package_state.c b/lib/package_state.c
index 6f347bb7..d072b805 100644
--- a/lib/package_state.c
+++ b/lib/package_state.c
@@ -87,8 +87,9 @@ get_state(prop_dictionary_t dict)
 
 	assert(dict != NULL);
 
-	prop_dictionary_get_cstring_nocopy(dict, "state", &state_str);
-	assert(state_str != NULL);
+	if (!prop_dictionary_get_cstring_nocopy(dict,
+	    "state", &state_str))
+		return 0;
 
 	for (stp = states; stp->string != NULL; stp++)
 		if (strcmp(state_str, stp->string) == 0)