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:
parent
55fbde1232
commit
02b28440a3
1 changed files with 3 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue