X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7929902d65215d481c59733a5d05b81e373b8237..916eabe60eee4adb05387bbf1eaf1915ae5eac18:/src/common/string.cpp?ds=sidebyside diff --git a/src/common/string.cpp b/src/common/string.cpp index 5729c48c65..04a606a3c5 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -168,7 +168,13 @@ static wxStrCacheStatsDumper s_showCacheStats; wxSTD ostream& operator<<(wxSTD ostream& os, const wxCStrData& str) { #if wxUSE_UNICODE && !wxUSE_UNICODE_UTF8 - return os << (const char *)str.AsCharBuf(); + const wxCharBuffer buf(str.AsCharBuf()); + if ( !buf ) + os.clear(wxSTD ios_base::failbit); + else + os << buf.data(); + + return os; #else return os << str.AsInternal(); #endif