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:
@@ -348,12 +348,16 @@ void wxXmlDocument::DoCopy(const wxXmlDocument& doc)
|
|||||||
bool wxXmlDocument::Load(const wxString& filename, const wxString& encoding)
|
bool wxXmlDocument::Load(const wxString& filename, const wxString& encoding)
|
||||||
{
|
{
|
||||||
wxFileInputStream stream(filename);
|
wxFileInputStream stream(filename);
|
||||||
|
if (!stream.Ok())
|
||||||
|
return false;
|
||||||
return Load(stream, encoding);
|
return Load(stream, encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxXmlDocument::Save(const wxString& filename) const
|
bool wxXmlDocument::Save(const wxString& filename) const
|
||||||
{
|
{
|
||||||
wxFileOutputStream stream(filename);
|
wxFileOutputStream stream(filename);
|
||||||
|
if (!stream.Ok())
|
||||||
|
return false;
|
||||||
return Save(stream);
|
return Save(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user