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
This commit is contained in:
Vadim Zeitlin
2007-07-17 22:46:02 +00:00
parent 55fbde1232
commit 02b28440a3

View File

@@ -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;