X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f7b64fde9be7403bbae90ed6d141bfe2ba245c87..3201a1046ba71ba8e5ef2ed694fde34d12f743f3:/src/html/m_pre.cpp?ds=sidebyside diff --git a/src/html/m_pre.cpp b/src/html/m_pre.cpp index c69db2129d..c4a33f8c82 100644 --- a/src/html/m_pre.cpp +++ b/src/html/m_pre.cpp @@ -33,16 +33,19 @@ static wxString LINKAGEMODE HtmlizeLinebreaks(const wxString& str) wxString out; out.reserve(str.length()); // we'll certainly need at least that - for ( wxString::const_iterator i = str.begin(); i != str.end(); ++i ) + const wxString::const_iterator end = str.end(); + for ( wxString::const_iterator i = str.begin(); i != end; ++i ) { switch ( (*i).GetValue() ) { case '<': - while ( i != str.end() && *i != '>') + while ( i != end && *i != '>' ) { out << *i++; } out << '>'; + if ( i == end ) + return out; break; case '\n': out << "
"; @@ -52,6 +55,7 @@ static wxString LINKAGEMODE HtmlizeLinebreaks(const wxString& str) break; } } + return out; }