]> git.saurik.com Git - wxWidgets.git/commitdiff
Version of [ 1177956 ] fix for wxString::operator=(wxChar *) for STL builds
authorRyan Norton <wxprojects@comcast.net>
Fri, 8 Apr 2005 14:06:25 +0000 (14:06 +0000)
committerRyan Norton <wxprojects@comcast.net>
Fri, 8 Apr 2005 14:06:25 +0000 (14:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/string.h

index 08d45448101524a2092c4a7536d4fc3b3f1f6dbf..94dc733c6c05480c1c1646254e9e331dd9419a6c 100644 (file)
@@ -843,9 +843,16 @@ public:
     // from a character
   wxString& operator=(wxChar ch)
     { return (wxString&)wxStringBase::operator=(ch); }
     // 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); }
   wxString& operator=(const wxChar *psz)
     { return (wxString&)wxStringBase::operator=(psz); }
+#endif
+
 #if wxUSE_UNICODE
     // from wxWCharBuffer
   wxString& operator=(const wxWCharBuffer& psz)
 #if wxUSE_UNICODE
     // from wxWCharBuffer
   wxString& operator=(const wxWCharBuffer& psz)