Check for errors in Util::htmlToXhtml

This commit is contained in:
Sude 2024-08-22 18:59:41 +03:00
parent 52b8bdc8fa
commit b30515bfea

View File

@ -1028,7 +1028,15 @@ std::string Util::htmlToXhtml(const std::string& html)
if ( rc >= 0 )
rc = tidySaveBuffer(doc, &buffer);
xhtml = std::string((char*)buffer.bp, buffer.size);
if (rc >= 0)
{
if (buffer.size > 0)
xhtml = std::string((char*)buffer.bp, buffer.size);
}
else
{
std::cerr << "Severe error occured: " << std::string(strerror(rc)) << std::endl;
}
tidyBufFree(&buffer);
tidyRelease(doc);