Fix json parsing to handle empty objects and ensure hm_ilist is properly set on htsmsg_add_msg to allow some post load modifications.
This commit is contained in:
parent
bccec43222
commit
11944f0933
2 changed files with 6 additions and 1 deletions
|
@ -258,6 +258,7 @@ htsmsg_add_msg(htsmsg_t *msg, const char *name, htsmsg_t *sub)
|
|||
|
||||
assert(sub->hm_data == NULL);
|
||||
TAILQ_MOVE(&f->hmf_msg.hm_fields, &sub->hm_fields, hmf_link);
|
||||
f->hmf_msg.hm_islist = sub->hm_islist;
|
||||
free(sub);
|
||||
}
|
||||
|
||||
|
@ -275,6 +276,7 @@ htsmsg_add_msg_extname(htsmsg_t *msg, const char *name, htsmsg_t *sub)
|
|||
|
||||
assert(sub->hm_data == NULL);
|
||||
TAILQ_MOVE(&f->hmf_msg.hm_fields, &sub->hm_fields, hmf_link);
|
||||
f->hmf_msg.hm_islist = sub->hm_islist;
|
||||
free(sub);
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,10 @@ htsmsg_json_parse_object(const char *s, const char **endp)
|
|||
|
||||
r = htsmsg_create_map();
|
||||
|
||||
while(1) {
|
||||
while(*s > 0 && *s < 33)
|
||||
s++;
|
||||
|
||||
if(*s != '}') while(1) {
|
||||
|
||||
if((name = htsmsg_json_parse_string(s, &s2)) == NULL) {
|
||||
htsmsg_destroy(r);
|
||||
|
|
Loading…
Add table
Reference in a new issue