@@ -130,7 +130,11 @@ static void json_write_raw (json_t *json, const char *buffer, size_t len, bool e
}
static void json_write_escaped (json_t *json, const char *buffer, size_t len, bool escape, bool is_pretty) {
- if (!len) return;
+ if (!len) {
+ json_write_raw(json, "", 0, escape, is_pretty);
+ return;
+ }
+
char *new_buffer = mem_alloc (len*2);
size_t j = 0;
assert(new_buffer);