Skip to content

Commit

Permalink
Check for errors in Util::htmlToXhtml
Browse files Browse the repository at this point in the history
  • Loading branch information
Sude- committed Aug 22, 2024
1 parent 52b8bdc commit b30515b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b30515b

Please sign in to comment.