X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/df5168c427b51f1ab2b3200a5c8f7626b3d24aae..88e3652fd0c13feb4fcd843bd0d1167ab84041c1:/src/common/filesys.cpp diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index c1e3070423..6892ca1ecf 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -7,7 +7,7 @@ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "filesys.h" #endif @@ -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)