check that the stream is valid before using it in Load() and Save() (patch 1516432)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40285 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2006-07-24 18:06:57 +00:00
parent e617d19d32
commit 97757cee26

View File

@ -348,12 +348,16 @@ void wxXmlDocument::DoCopy(const wxXmlDocument& doc)
bool wxXmlDocument::Load(const wxString& filename, const wxString& encoding)
{
wxFileInputStream stream(filename);
if (!stream.Ok())
return false;
return Load(stream, encoding);
}
bool wxXmlDocument::Save(const wxString& filename) const
{
wxFileOutputStream stream(filename);
if (!stream.Ok())
return false;
return Save(stream);
}