commit 7b878d6bf1c706b9c3960bb8cd702060f56b7a44
parent 6ec38ab47fa3786fb29e22eb66364419b6f0288f
Author: William Casarin <jb55@jb55.com>
Date: Wed, 27 Dec 2023 12:41:19 -0800
cursor: fix empty string pushing in push_c_str
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/cursor.h b/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);
}