]> git.saurik.com Git - wxWidgets.git/commitdiff
handle locales where AM/PM strings are empty
authorFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Sat, 21 Mar 2009 00:19:27 +0000 (00:19 +0000)
committerFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Sat, 21 Mar 2009 00:19:27 +0000 (00:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/datetimefmt.cpp

index 98c70a6cd142aaf116e5ab76246fc29df9b9829c..57c23124659f1956e28f73af25166e5b5e7c637b 100644 (file)
@@ -1329,6 +1329,13 @@ wxDateTime::ParseFormat(const wxString& date,
             case _T('p'):       // AM or PM string
                 {
                     wxString am, pm, token = GetAlphaToken(input);
             case _T('p'):       // AM or PM string
                 {
                     wxString am, pm, token = GetAlphaToken(input);
+                    
+                    // some locales have empty AM/PM tokens and thus when formatting
+                    // dates with the %p specifier mpthomg os gemerated; when trying to
+                    // parse them back, we get an empty token here... but that's not
+                    // an error.
+                    if (token.empty())
+                        break;
 
                     GetAmPmStrings(&am, &pm);
                     if (am.empty() && pm.empty())
 
                     GetAmPmStrings(&am, &pm);
                     if (am.empty() && pm.empty())