More static analyser fixes; version bump to 5.9.7.

This commit is contained in:
Jim Derry 2021-07-30 18:45:18 -04:00
parent 5f98ccd606
commit 1213047d42
2 changed files with 15 additions and 12 deletions

View file

@ -4353,7 +4353,7 @@ Node* TY_(ParseHTML)( TidyDocImpl *doc, Node *html, GetTokenMode mode, Bool popS
} }
/* Find and discard multiple <html> elements. */ /* Find and discard multiple <html> elements. */
if (node->tag == html->tag && node->type == StartTag) if (html && (node->tag == html->tag) && (node->type == StartTag))
{ {
TY_(Report)(doc, html, node, DISCARDING_UNEXPECTED); TY_(Report)(doc, html, node, DISCARDING_UNEXPECTED);
TY_(FreeNode)(doc, node); TY_(FreeNode)(doc, node);
@ -5387,7 +5387,7 @@ Node* TY_(ParseNamespace)( TidyDocImpl* doc, Node *basenode, GetTokenMode mode,
TY_(FreeNode)(doc, node); TY_(FreeNode)(doc, node);
node = n; node = n;
parent = node->parent; parent = node ? node->parent : NULL;
} }
else else
{ {
@ -5401,7 +5401,7 @@ Node* TY_(ParseNamespace)( TidyDocImpl* doc, Node *basenode, GetTokenMode mode,
if (node == basenode) if (node == basenode)
{ {
lexer->istackbase = istackbase; lexer->istackbase = istackbase;
assert(basenode->closed == yes); assert(basenode && basenode->closed == yes);
return NULL; return NULL;
} }
} }
@ -6301,14 +6301,16 @@ void TY_(InsertNodeAtStart)(Node *element, Node *node)
void TY_(InsertNodeAtEnd)(Node *element, Node *node) void TY_(InsertNodeAtEnd)(Node *element, Node *node)
{ {
node->parent = element; node->parent = element;
node->prev = element->last; node->prev = element ? element->last : NULL;
if (element->last != NULL) if (element && element->last != NULL)
element->last->next = node; element->last->next = node;
else else
element->content = node; if (element)
element->content = node;
element->last = node; if (element)
element->last = node;
} }
@ -6319,16 +6321,17 @@ void TY_(InsertNodeBeforeElement)(Node *element, Node *node)
{ {
Node *parent; Node *parent;
parent = element->parent; parent = element ? element->parent : NULL;
node->parent = parent; node->parent = parent;
node->next = element; node->next = element;
node->prev = element->prev; node->prev = element ? element->prev : NULL;
element->prev = node; if (element)
element->prev = node;
if (node->prev) if (node->prev)
node->prev->next = node; node->prev->next = node;
if (parent->content == element) if (parent && parent->content == element)
parent->content = node; parent->content = node;
} }

View file

@ -1,2 +1,2 @@
5.9.6 5.9.7
2021.07.30 2021.07.30