From: Sebastian Harl Date: Wed, 11 Mar 2015 19:02:07 +0000 (+0100) Subject: store_expr: iterator: Support constant arrays without a stored object. X-Git-Tag: sysdb-0.8.0~124 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=37a6120ee39ef331f2ccf6e484e24cba96b9c15a;p=sysdb.git store_expr: iterator: Support constant arrays without a stored object. --- diff --git a/src/core/store_expr.c b/src/core/store_expr.c index 8fc063d..60b0bea 100644 --- a/src/core/store_expr.c +++ b/src/core/store_expr.c @@ -302,10 +302,12 @@ sdb_store_expr_iter(sdb_store_expr_t *expr, sdb_store_obj_t *obj, sdb_avltree_iter_t *tree = NULL; sdb_data_t array = SDB_DATA_INIT; - if ((! expr) || (! obj)) + if (! expr) return NULL; if (expr->type == TYPED_EXPR) { + if (! obj) + return NULL; if (obj->type == SDB_HOST) { if (expr->data.data.integer == SDB_SERVICE) tree = sdb_avltree_get_iter(HOST(obj)->services); @@ -324,6 +326,8 @@ sdb_store_expr_iter(sdb_store_expr_t *expr, sdb_store_obj_t *obj, } } else if (expr->type == FIELD_VALUE) { + if (! obj) + return NULL; if (expr->data.data.integer == SDB_FIELD_BACKEND) { /* while scanning the store, we hold a read lock, so it's safe to * access the data without copying */