Browse Source

Fixed an issue in json serializer (fix for empty strings).

Marco Bambini 8 years ago
parent
commit
e6725c79bf
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/utils/gravity_json.c

+ 5 - 1
src/utils/gravity_json.c

@@ -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) {
 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);
 	char	*new_buffer = mem_alloc (len*2);
 	size_t	j = 0;
 	size_t	j = 0;
 	assert(new_buffer);
 	assert(new_buffer);