Test for encoding conversion success in wxFile::Write to avoid crash

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2007-03-24 10:21:48 +00:00
parent f3140390f9
commit bd3f83f763

View File

@ -100,8 +100,13 @@ public:
bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8)
{
const wxWX2MBbuf buf = s.mb_str(conv);
size_t size = strlen(buf);
return Write((const char *) buf, size) == size;
if (buf)
{
size_t size = strlen(buf);
return Write((const char *) buf, size) == size;
}
else
return false;
}
// flush data not yet written
bool Flush();