mirror of
https://github.com/simon987/sist2.git
synced 2025-04-16 00:46:43 +00:00
Fix segfault in print_errors()
This commit is contained in:
parent
2b639bd4ac
commit
a10d6952ba
@ -214,7 +214,13 @@ void print_errors(response_t *r) {
|
||||
*(tmp + r->size) = '\0';
|
||||
|
||||
cJSON *ret_json = cJSON_Parse(tmp);
|
||||
if (cJSON_GetObjectItem(ret_json, "errors")->valueint != 0) {
|
||||
cJSON *errors = cJSON_GetObjectItem(ret_json, "errors");
|
||||
|
||||
if (errors == NULL) {
|
||||
char *str = cJSON_Print(ret_json);
|
||||
LOG_ERRORF("elastic.c", "%s\n", str);
|
||||
cJSON_free(str);
|
||||
} else if (errors->valueint != 0) {
|
||||
cJSON *err;
|
||||
cJSON_ArrayForEach(err, cJSON_GetObjectItem(ret_json, "items")) {
|
||||
if (cJSON_GetObjectItem(cJSON_GetObjectItem(err, "index"), "status")->valueint != 201) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user