fix for converting empty lists and dicts

This commit is contained in:
Willem Toorop 2016-07-14 14:06:00 +02:00
parent 2485c11e32
commit 906a8d68c2
1 changed files with 8 additions and 2 deletions

View File

@ -410,7 +410,10 @@ static int _jsmn_get_dict(struct mem_funcs *mf, const char *js, jsmntok_t *t,
char key_spc[1024], *key = NULL;
getdns_item child_item;
for (i = 0; i < t->size; i++) {
if (t->size <= 0)
*r = GETDNS_RETURN_GOOD;
else for (i = 0; i < t->size; i++) {
if (t[j].type != JSMN_STRING &&
t[j].type != JSMN_PRIMITIVE) {
@ -484,7 +487,10 @@ static int _jsmn_get_list(struct mem_funcs *mf, const char *js, jsmntok_t *t,
size_t i, j = 1, index = 0;
getdns_item child_item;
for (i = 0; i < t->size; i++) {
if (t->size <= 0)
*r = GETDNS_RETURN_GOOD;
else for (i = 0; i < t->size; i++) {
j += _jsmn_get_item(mf, js, t + j, count - j, &child_item, r);
if (*r) break;