Skip to content

Commit

Permalink
check for tag type before accessing node data... (#7)
Browse files Browse the repository at this point in the history
some nodes are "spaces" or empty nodes.
they may have garbage data, so we need to find
the exactly node type.

Co-authored-by: root <root@AKINTB071.intranet.akiyama>
  • Loading branch information
diasbruno and root authored Jun 26, 2024
1 parent 7c3f31b commit 59802c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wiki-registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ wiki_registry_parse(const char *html) {
GumboNode *heading = (GumboNode *)children.data[index];
GumboNode *ul = NULL;

if (heading->v.element.tag != GUMBO_TAG_DIV) {
continue;
}

GumboAttribute *node_id = gumbo_get_attribute(&heading->v.element.attributes, "class");
if (node_id == NULL || strncmp(node_id->value, "markdown-heading", 16) != 0) {
continue;
Expand Down

0 comments on commit 59802c1

Please sign in to comment.