From 02b28440a309d4de68f8a17ea08be2dae8f45cf2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 17 Jul 2007 22:46:02 +0000 Subject: [PATCH] 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 --- utils/tex2rtf/src/texutils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.45.2