Procházet zdrojové kódy

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

Marco Bambini před 8 roky
rodič
revize
e6725c79bf
1 změnil soubory, kde provedl 5 přidání a 1 odebrání
  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) {
-	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);