Check for iterator validity when parsing "%%" in wxDateTime::Format() too.

This is similar to the previous commit and adds another missed check for the
iterator not being at the end of string.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70847 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-03-09 01:09:25 +00:00
parent 649148f93e
commit 1f29ecb357
2 changed files with 2 additions and 1 deletions

View File

@@ -1448,7 +1448,7 @@ wxDateTime::ParseFormat(const wxString& date,
break;
case wxT('%'): // a percent sign
if ( *input++ != wxT('%') )
if ( input == end || *input++ != wxT('%') )
{
// no match
return false;

View File

@@ -831,6 +831,7 @@ void DateTimeTestCase::TestTimeFormat()
// test some degenerate cases
CPPUNIT_ASSERT( !dt.ParseFormat("", "%z") );
CPPUNIT_ASSERT( !dt.ParseFormat("", "%%") );
// test compilation of some calls which should compile (and not result in
// ambiguity because of char*<->wxCStrData<->wxString conversions)