From 887eb4e1e2148026d43cb2f66570d80aa14d0eb0 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Wed, 27 Dec 2023 12:41:19 -0800 Subject: [PATCH] nostrdb/cursor: fix empty string pushing in push_c_str Signed-off-by: William Casarin --- nostrdb/src/cursor.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nostrdb/src/cursor.h b/nostrdb/src/cursor.h index c38a8daf..7cc449b3 100644 --- a/nostrdb/src/cursor.h +++ b/nostrdb/src/cursor.h @@ -398,6 +398,8 @@ static inline int cursor_push_str(struct cursor *cursor, const char *str) static inline int cursor_push_c_str(struct cursor *cursor, const char *str) { + if (str == NULL) + return cursor_push_byte(cursor, 0); return cursor_push_str(cursor, str) && cursor_push_byte(cursor, 0); }