]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wfstream.cpp
added check for NULL Clone() return
[wxWidgets.git] / src / common / wfstream.cpp
index b28617d537d666bf65146a5edea093b3c957626b..3605e2a7071b91c19e617a079665f092f5a16336 100644 (file)
@@ -103,6 +103,16 @@ wxFileOutputStream::wxFileOutputStream(const wxString& fileName)
 {
     m_file = new wxFile(fileName, wxFile::write);
     m_file_destroy = TRUE;
+    
+    if (!m_file->IsOpened())
+    {
+        m_lasterror = wxSTREAM_WRITE_ERROR;
+    }
+    else
+    {
+        if (m_file->Error())
+            m_lasterror = wxSTREAM_WRITE_ERROR;
+    }
 }
 
 wxFileOutputStream::wxFileOutputStream(wxFile& file)
@@ -250,6 +260,16 @@ wxFFileOutputStream::wxFFileOutputStream(const wxString& fileName)
 {
     m_file = new wxFFile(fileName, "w+b");
     m_file_destroy = TRUE;
+    
+    if (!m_file->IsOpened())
+    {
+        m_lasterror = wxSTREAM_WRITE_ERROR;
+    }
+    else
+    {
+        if (m_file->Error())
+            m_lasterror = wxSTREAM_WRITE_ERROR;
+    }
 }
 
 wxFFileOutputStream::wxFFileOutputStream(wxFFile& file)