We need to check, in closeFontTags(), for the case where we haven't

had any content.
This commit is contained in:
Richard Heck 2012-04-08 10:02:40 -04:00
parent 29cf7af6d3
commit 8dd436b7dc
2 changed files with 20 additions and 0 deletions

View File

@ -233,8 +233,15 @@ namespace {
bool XHTMLStream::closeFontTags()
{
if (isTagPending(parsep_tag))
// we haven't had any content
return true;
// this may be a useless check, since we ought at least to have
// the parsep_tag. but it can't hurt too much to be careful.
if (tag_stack_.empty())
return true;
// first, we close any open font tags we can close
html::StartTag curtag = tag_stack_.back();
while (html::isFontTag(curtag.tag_)) {
@ -429,6 +436,17 @@ bool XHTMLStream::isTagOpen(string const & stag) const
}
bool XHTMLStream::isTagPending(string const & stag) const
{
TagStack::const_iterator sit = pending_tags_.begin();
TagStack::const_iterator const sen = pending_tags_.end();
for (; sit != sen; ++sit)
if (sit->tag_ == stag)
return true;
return false;
}
// this is complicated, because we want to make sure that
// everything is properly nested. the code ought to make
// sure of that, but we won't assert (yet) if we run into

View File

@ -146,6 +146,8 @@ private:
///
bool isTagOpen(std::string const &) const;
///
bool isTagPending(std::string const &) const;
///
void writeError(std::string const &) const;
///
odocstream & os_;