summaryrefslogtreecommitdiff
path: root/common/lib/libprop/prop_array.c
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2006-08-22 21:21:23 +0000
committerthorpej <thorpej@NetBSD.org>2006-08-22 21:21:23 +0000
commitbeabdd9bdd29daa37848ac07c9fc4616151e7ee5 (patch)
treec41090182dcf05e5a3f8e35ab3efff609fbe44dc /common/lib/libprop/prop_array.c
parent22b67e3c33b009a70d8ef3092da5fce8e028ecdf (diff)
Also guard object accessors against NULL (like we do foreign object types)
so that apps can use this construct safely: obj = prop_dictionary_get(dict, "value"); if (! prop_number_equals_integer(obj, 5)) { ... } Suggested by Iain Hibbert.
Diffstat (limited to 'common/lib/libprop/prop_array.c')
-rw-r--r--common/lib/libprop/prop_array.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/lib/libprop/prop_array.c b/common/lib/libprop/prop_array.c
index 0f378a0ae2d..a075b475868 100644
--- a/common/lib/libprop/prop_array.c
+++ b/common/lib/libprop/prop_array.c
@@ -1,4 +1,4 @@
-/* $NetBSD: prop_array.c,v 1.5 2006/08/21 15:39:02 he Exp $ */
+/* $NetBSD: prop_array.c,v 1.6 2006/08/22 21:21:23 thorpej Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@ static const struct _prop_object_type _prop_object_type_array = {
};
#define prop_object_is_array(x) \
- ((x)->pa_obj.po_type == &_prop_object_type_array)
+ ((x) != NULL && (x)->pa_obj.po_type == &_prop_object_type_array)
#define prop_array_is_immutable(x) (((x)->pa_flags & PA_F_IMMUTABLE) != 0)