Skip to content

Commit 7472585

Browse files
committed
Fix bug with object value fetching
1 parent 8e23c2d commit 7472585

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

c/src/jsonParser.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,12 @@ jsonValue_t * jsonObject_get(const jsonObject_t * restrict self, const char * re
591591
{
592592
assert(self != NULL);
593593
assert(key != NULL);
594-
return hashMap_get(&self->map, key)->value;
594+
hashNode_t * node = hashMap_get(&self->map, key);
595+
if (node == NULL)
596+
{
597+
return NULL;
598+
}
599+
return node->value;
595600
}
596601
bool jsonObject_remove(jsonObject_t * restrict self, const char * restrict key)
597602
{

0 commit comments

Comments
 (0)