json patch: adding to a subfield of a non-object now fails as expected

This commit is contained in:
Bob Kocisko committed 2018-03-22 11:10:29 -04:00
1 parent 6f264b5d0c
commit d26a42af8d
2 files changed
+14 -1

No files matched your search

+6
View File
@@ -988,6 +988,12 @@ static int apply_patch(cJSON *object, const cJSON *patch, const cJSON_bool case_
cJSON_AddItemToObject(parent, (char*)child_pointer, value);
value = NULL;
}
else /* parent is not an object */
{
/* Couldn't find object to add to. */
status = 9;
goto cleanup;
}
cleanup:
if (value != NULL)