From: Julian Smart Date: Sat, 24 Mar 2007 10:20:14 +0000 (+0000) Subject: Test for encoding conversion success in wxFFile::Write to avoid crash X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f3140390f99a9f2e78840451ee0eff2af0bc0af0 Test for encoding conversion success in wxFFile::Write to avoid crash git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45041 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/ffile.h b/include/wx/ffile.h index 58aca44eaf..1a4c3c0de8 100644 --- a/include/wx/ffile.h +++ b/include/wx/ffile.h @@ -65,8 +65,13 @@ public: bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto()) { 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();