Avoid crash in tidyCleanAndRepair if document was not loaded
These services can only be used when there is a document loaded, ie a lexer created. But really should not be calling a Clean and Repair service with no doc!
This commit is contained in:
parent
d332908e5d
commit
10281040ca
|
@ -1908,9 +1908,18 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc )
|
||||||
it can ever be, so we can start detecting things that shouldn't
|
it can ever be, so we can start detecting things that shouldn't
|
||||||
be in this version of HTML
|
be in this version of HTML
|
||||||
*/
|
*/
|
||||||
|
if (doc->lexer)
|
||||||
|
{
|
||||||
|
/*\
|
||||||
|
* Issue #429 #426 - These services can only be used
|
||||||
|
* when there is a document loaded, ie a lexer created.
|
||||||
|
* But really should not be calling a Clean and Repair
|
||||||
|
* service with no doc!
|
||||||
|
\*/
|
||||||
if (doc->lexer->versionEmitted & VERS_HTML5)
|
if (doc->lexer->versionEmitted & VERS_HTML5)
|
||||||
TY_(CheckHTML5)( doc, &doc->root );
|
TY_(CheckHTML5)( doc, &doc->root );
|
||||||
TY_(CheckHTMLTagsAttribsVersions)( doc, &doc->root );
|
TY_(CheckHTMLTagsAttribsVersions)( doc, &doc->root );
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
SPRTF("All nodes AFTER clean and repair\n");
|
SPRTF("All nodes AFTER clean and repair\n");
|
||||||
|
|
Loading…
Reference in a new issue