]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filesys.cpp
TransferFrom/ToWindow() were reverted, fixed
[wxWidgets.git] / src / common / filesys.cpp
index 648130d0014d6a3b41b9f5d7cc5238330cede6a5..6892ca1ecf109ef5431b8005521ccd10276f88dd 100644 (file)
@@ -186,7 +186,16 @@ wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString&
     if (!wxFileExists(fullpath))
         return (wxFSFile*) NULL;
 
-    return new wxFSFile(new wxFFileInputStream(fullpath),
+    // we need to check whether we can really read from this file, otherwise
+    // wxFSFile is not going to work
+    wxFFileInputStream *is = new wxFFileInputStream(fullpath);
+    if ( !is->Ok() )
+    {
+        delete is;
+        return (wxFSFile*) NULL;
+    }
+
+    return new wxFSFile(is,
                         right,
                         GetMimeTypeFromExt(location),
                         GetAnchor(location)