X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/14f355c2b5c71fc7c3d680aea366582d2ac60f7b..007bea23c3245bac82c24c0f783a7baa5ac672cc:/src/common/filesys.cpp diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index 648130d001..6892ca1ecf 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -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)