From be74dc8800cde56bb0f06f501dfb05c88dc5f2cc Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 Dec 2006 18:54:48 +0000 Subject: [PATCH] don't call fputs() with NULL buffer, it crashes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43772 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wxchar.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index f79bd0cbb8..962a705dcd 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -1222,9 +1222,13 @@ int WXDLLEXPORT wxSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...) #ifdef wxNEED_FPUTS int wxFputs(const wchar_t *ws, FILE *stream) { + wxCharBuffer buf(wxConvLibc.cWC2MB(ws)); + if ( !buf ) + return -1; + // counting the number of wide characters written isn't worth the trouble, // simply distinguish between ok and error - return fputs(wxConvLibc.cWC2MB(ws), stream) == -1 ? -1 : 0; + return fputs(buf, stream) == -1 ? -1 : 0; } #endif // wxNEED_FPUTS -- 2.45.2