From 05c5a6dacbbca5bb74afaebbfde2560194d61e20 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 8 Jan 2024 14:29:44 -0800 Subject: [PATCH] nostrdb/filter: don't end field if we don't have one active Signed-off-by: William Casarin --- nostrdb/src/nostrdb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nostrdb/src/nostrdb.c b/nostrdb/src/nostrdb.c index 593e4b2a..5d21b631 100644 --- a/nostrdb/src/nostrdb.c +++ b/nostrdb/src/nostrdb.c @@ -904,6 +904,10 @@ void ndb_filter_end_field(struct ndb_filter *filter) struct ndb_filter_elements *cur; cur = filter->current; + + if (cur == NULL) + return; + filter->elements[filter->num_elements++] = cur; // sort elements for binary search