Don't assert in wxDateTime::Format("%p") in locales not using AM/PM.

If a locale doesn't use AM/PM strings, strftime() can return an empty string
which does not indicate an error, so don't assert that strftime() failed in
this case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-10-13 14:54:29 +00:00
parent bb8823c958
commit c105b3cdd4

View File

@@ -437,8 +437,15 @@ wxString CallStrftime(const wxString& format, const tm* tm)
if ( !wxStrftime(buf, WXSIZEOF(buf), format, tm) )
{
// if the format is valid, buffer must be too small?
wxFAIL_MSG(wxT("strftime() failed"));
// There is one special case in which strftime() can return 0 without
// indicating an error: "%p" may give empty string depending on the
// locale, so check for it explicitly. Apparently it's really the only
// exception.
if ( format != wxS("%p") )
{
// if the format is valid, buffer must be too small?
wxFAIL_MSG(wxT("strftime() failed"));
}
buf[0] = '\0';
}