Protext agains a NULL node in the Debug only code
This commit is contained in:
parent
6ebd527750
commit
9960f7c6dd
20
src/lexer.c
20
src/lexer.c
|
@ -91,8 +91,8 @@ static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node )
|
||||||
}
|
}
|
||||||
if (lexer && lexer->token && (lexer->token->type == TextNode)) {
|
if (lexer && lexer->token && (lexer->token->type == TextNode)) {
|
||||||
if (show_attrs) {
|
if (show_attrs) {
|
||||||
uint len = node->end - node->start;
|
uint len = node ? node->end - node->start : 0;
|
||||||
tmbstr cp = get_text_string( lexer, node );
|
tmbstr cp = node ? get_text_string( lexer, node ) : "NULL";
|
||||||
SPRTF("Returning %s TextNode [%s]%u %s\n", msg, cp, len,
|
SPRTF("Returning %s TextNode [%s]%u %s\n", msg, cp, len,
|
||||||
lex ? "lexer" : "stream");
|
lex ? "lexer" : "stream");
|
||||||
} else {
|
} else {
|
||||||
|
@ -102,14 +102,16 @@ static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node )
|
||||||
} else {
|
} else {
|
||||||
if (show_attrs) {
|
if (show_attrs) {
|
||||||
AttVal* av;
|
AttVal* av;
|
||||||
tmbstr name = node->element ? node->element : "blank";
|
tmbstr name = node ? node->element ? node->element : "blank" : "NULL";
|
||||||
SPRTF("Returning %s node <%s", msg, name);
|
SPRTF("Returning %s node <%s", msg, name);
|
||||||
for (av = node->attributes; av; av = av->next) {
|
if (node) {
|
||||||
name = av->attribute;
|
for (av = node->attributes; av; av = av->next) {
|
||||||
if (name) {
|
name = av->attribute;
|
||||||
SPRTF(" %s",name);
|
if (name) {
|
||||||
if (av->value) {
|
SPRTF(" %s",name);
|
||||||
SPRTF("=\"%s\"", av->value);
|
if (av->value) {
|
||||||
|
SPRTF("=\"%s\"", av->value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue