check whether input stream is readable in OpenFile() (patch 808941)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@23699 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-09-19 00:01:08 +00:00
parent ac0f346dca
commit ec58a24047

View File

@@ -187,7 +187,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),