修复JSON删除元素BUG

This commit is contained in:
gb 2022-09-28 11:58:39 +08:00
parent 5e859cd6ca
commit 98cdfe6402
1 changed files with 10 additions and 2 deletions

View File

@ -559,8 +559,16 @@ namespace gb
if(ele) if(ele)
{ {
if(addr) //if(addr)
*addr = NULL; // *addr = ele->next;
if (cur_child_ == ele)
cur_child_ = ele->prev;
if (ele->prev)
ele->prev->next = ele->next;
if (ele->next)
ele->next->prev = ele->prev;
ele->prev = NULL;
ele->next = NULL;
cJSON_Delete(ele); cJSON_Delete(ele);
return true; return true;