From: Vadim Zeitlin Date: Tue, 17 Jul 2007 22:46:02 +0000 (+0000) Subject: check whether the string is non-empty before accessing its first element X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/02b28440a309d4de68f8a17ea08be2dae8f45cf2 check whether the string is non-empty before accessing its first element git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47535 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/utils/tex2rtf/src/texutils.cpp b/utils/tex2rtf/src/texutils.cpp index eead3b6dfc..4133290545 100644 --- a/utils/tex2rtf/src/texutils.cpp +++ b/utils/tex2rtf/src/texutils.cpp @@ -479,9 +479,9 @@ void BibEatWhiteSpace(wxString& line) } // Ignore end-of-line comments - if (line[0] == _T('%') || line[0] == _T(';') || line[0] == _T('#')) + if ( !line.empty() && (line[0] == _T('%') || line[0] == _T(';') || line[0] == _T('#'))) { - line = wxEmptyString; + line.clear(); } } @@ -569,7 +569,7 @@ wxString BibReadToEOL(wxString& line) val << line[0]; line = line.substr(1); } - if (line[0] == '"') + if (!line.empty() && line[0] == '"') line = line.substr(1); return val;