From: Ryan Norton Date: Fri, 8 Apr 2005 14:06:25 +0000 (+0000) Subject: Version of [ 1177956 ] fix for wxString::operator=(wxChar *) for STL builds X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c57e3bd53e52b819c2cb42cb3d5b222f3b6b495a?hp=5234c3f3ce49a38e4d27ecaeddcf8b71b9cdefd2 Version of [ 1177956 ] fix for wxString::operator=(wxChar *) for STL builds git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/string.h b/include/wx/string.h index 08d4544810..94dc733c6c 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -843,9 +843,16 @@ public: // from a character wxString& operator=(wxChar ch) { return (wxString&)wxStringBase::operator=(ch); } - // from a C string + // from a C string - STL probably will crash on NULL, + // so we need to compensate in that case +#if wxUSE_STL + wxString& operator=(const wxChar *psz) + { if(psz) wxStringBase::operator=(psz); else Clear(); return *this; } +#else wxString& operator=(const wxChar *psz) { return (wxString&)wxStringBase::operator=(psz); } +#endif + #if wxUSE_UNICODE // from wxWCharBuffer wxString& operator=(const wxWCharBuffer& psz)