else
{
while (i < end_pos && *i != wxT('>')) ++i;
- textBeginning = i+1;
+ textBeginning = i < end_pos ? i+1 : i;
}
}
else ++i;
wxString::const_iterator p = start;
- // comments begin with "<!--" in HTML 4.0
- if ( p > end - 3 || *++p != '!' || *++p != '-' || *++p != '-' )
- {
- // not a comment at all
- return false;
- }
+ // Comments begin with "<!--" in HTML 4.0; anything shorter or not containing
+ // these characters is not a comment and we're not going to skip it.
+ if ( ++p == end || *p != '!' )
+ return false;
+ if ( ++p == end || *p != '-' )
+ return false;
+ if ( ++p == end || *p != '-' )
+ return false;
// skip the start of the comment tag in any case, if we don't find the
// closing tag we should ignore broken markup