From 7bf6f523e7a41c094765bd5dc42da71342e5e32c Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 4 May 2008 08:45:43 +0000 Subject: [PATCH] fixed incorrect handling of end iterator in HtmlizeLinebreaks() introduced in r53298 (patch #1956966) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/m_pre.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } -- 2.45.2