Przeglądaj źródła

:bug: Debug tableau json

Arthur Brandao 6 lat temu
rodzic
commit
6a64057ee6
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      Serveur/json_array.c

+ 2 - 2
Serveur/json_array.c

@@ -418,6 +418,7 @@ void ini_array_encoder(JsonArray* this) {
     //Initialisation en mode encoder
     this->mode = JSON_ARRAY_ENCODER;
     this->encoder = malloc(sizeof (JsonArrayEncoder));
+    this->encoder->tab = NULL;
 }
 
 boolean add_array_value(JsonArray* this, char* str) {
@@ -546,7 +547,7 @@ char* json_encode_array(JsonArray* this) {
 /* --- Fonctions publiques --- */
 
 void clean_json_array(JsonArray* this) {
-    if (this->mode) {
+    if (this->mode == JSON_ARRAY_ENCODER) {
         JsonNode* node, * tmp;
         node = this->encoder->tab;
         while (node != NULL) {
@@ -556,7 +557,6 @@ void clean_json_array(JsonArray* this) {
             node = tmp;
         }
         free(this->encoder);
-        
     } else {
         //Parser
         free(this->parser->type);