summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b0e3b49)
raw | patch | inline | side by side (parent: b0e3b49)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 19 Oct 2014 12:58:45 +0000 (14:58 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 19 Oct 2014 12:58:45 +0000 (14:58 +0200) |
src/core/store_expr.c | patch | blob | history |
diff --git a/src/core/store_expr.c b/src/core/store_expr.c
index 0a8757f0911568b5b9b2cf8c66ad1fcc0ade62cd..ed0589bc28d1a37c32c6ea93400331410b01c532 100644 (file)
--- a/src/core/store_expr.c
+++ b/src/core/store_expr.c
return sdb_data_copy(res, &expr->data);
else if (expr->type == FIELD_VALUE)
return sdb_store_get_field(obj, (int)expr->data.data.integer, res);
- else if (expr->type == ATTR_VALUE)
- return sdb_store_get_attr(obj, expr->data.data.string, res, filter);
+ else if (expr->type == ATTR_VALUE) {
+ status = sdb_store_get_attr(obj, expr->data.data.string, res, filter);
+ if ((status < 0) && obj) {
+ /* attribute does not exist => NULL */
+ status = 0;
+ res->type = SDB_TYPE_STRING;
+ res->data.string = NULL;
+ }
+ return status;
+ }
if (sdb_store_expr_eval(expr->left, obj, &v1, filter))
return -1;