mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
cJSONUtils_ApplyPatches: Fail if removal failed
This commit is contained in:
parent
a1602f484b
commit
8efb287ae2
@ -456,10 +456,15 @@ static int cJSONUtils_ApplyPatch(cJSON *object, cJSON *patch)
|
||||
if ((opcode == 1) || (opcode == 2))
|
||||
{
|
||||
/* Get rid of old. */
|
||||
cJSON_Delete(cJSONUtils_PatchDetach(object, (unsigned char*)path->valuestring));
|
||||
cJSON *old_item = cJSONUtils_PatchDetach(object, (unsigned char*)path->valuestring);
|
||||
if (old_item == NULL)
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
cJSON_Delete(old_item);
|
||||
if (opcode == 1)
|
||||
{
|
||||
/* For Remove, this is job done. */
|
||||
/* For Remove, this job is done. */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user