Skip to content

Commit

Permalink
Fix crash reported on issue #107
Browse files Browse the repository at this point in the history
When comparing mappings there might be NULLs.

Signed-off-by: Pantelis Antoniou <[email protected]>
  • Loading branch information
pantoniou committed Jun 23, 2024
1 parent 23265a8 commit fff2e60
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/fy-doc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,9 @@ int fy_node_mapping_get_pair_index(struct fy_node *fyn, const struct fy_node_pai
struct fy_node_pair *fynpi;
int i;

if (!fy_node_is_mapping(fyn))
return -1;

for (i = 0, fynpi = fy_node_pair_list_head(&fyn->mapping); fynpi;
fynpi = fy_node_pair_next(&fyn->mapping, fynpi), i++) {

Expand Down

0 comments on commit fff2e60

Please sign in to comment.