check whether the string is non-empty before accessing its first element [backport from trunk]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47536 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-07-17 22:47:30 +00:00
parent 83ea1b79e7
commit 61044f83ce

View File

@@ -478,9 +478,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();
}
}
@@ -568,7 +568,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;