Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Check config objects for NULL with reasonable default.
Vsevolod Stakhov committed 12 years ago
commit 680c5a3db60d82bd03bca03646bc1e3ba3a7fa71
parent e3eb7f359fdf8676f554900fc4ee07f60bb811e4
1 file changed +4 -2
modified libpkg/pkg_object.c
@@ -89,7 +89,8 @@ pkg_object_type(const pkg_object *o)
bool
pkg_object_bool(const pkg_object *o)
{
-
	assert(o->type == UCL_BOOLEAN);
+
	if (o == NULL || o->type != UCL_BOOLEAN)
+
		return (false);

	return (ucl_object_toboolean(o));
}
@@ -112,7 +113,8 @@ pkg_object_string(const pkg_object *o)
int64_t
pkg_object_int(const pkg_object *o)
{
-
	assert(o->type == UCL_INT);
+
	if (o == NULL || o->type != UCL_INT)
+
		return (0);

	return (ucl_object_toint(o));
}