]> git.saurik.com Git - wxWidgets.git/commitdiff
crush compiler warnings and handle out of memory errors slightly better
authorRyan Norton <wxprojects@comcast.net>
Wed, 13 Oct 2004 02:54:32 +0000 (02:54 +0000)
committerRyan Norton <wxprojects@comcast.net>
Wed, 13 Oct 2004 02:54:32 +0000 (02:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/string.cpp

index a0b087ce0747d4ae246e6ab42ed508a1873115b3..b0060120421e565cc59df39952a983ec875eb23c 100644 (file)
@@ -1133,10 +1133,14 @@ wxString::wxString(const char *psz, wxMBConv& conv, size_t nLength)
         size_t nActualLength = wxWcstr(buffer, psz, nLen, conv);
         
         if ( !Alloc(nActualLength + 1) )
+        {
             wxFAIL_MSG(wxT("Out of memory in wxString"));
-
-        //Copy the data
-        assign(buffer.data(), nActualLength);
+        }
+        else
+        {
+            //Copy the data
+            assign(buffer.data(), nActualLength);
+        }
     }
 }        
 
@@ -1198,10 +1202,14 @@ wxString::wxString(const wchar_t *pwz, wxMBConv& conv, size_t nLength)
         size_t nActualLength = wxMbstr(buffer, pwz, nLen, conv);
         
         if ( !Alloc(nActualLength + 1) )
+        {
             wxFAIL_MSG(wxT("Out of memory in wxString"));
-
-        //copy the data
-        assign(buffer.data(), nActualLength);
+        }
+        else
+        {
+            //copy the data
+            assign(buffer.data(), nActualLength);
+        }
     }
 }