diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 93b8f02790..8e36cc40b7 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -116,6 +116,12 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt) WXDLLIMPEXP_CORE wxCharBuffer wxConvertToGTK(const wxString& s, wxFontEncoding enc) { + // Passing an empty string to cMB2WC() returns an invalid buffer, i.e. a + // buffer whose data is NULL and this can result in passing NULL to a GTK+ + // function and a crash, so handle this case specially to avoid this. + if ( s.empty() ) + return wxCharBuffer(""); + wxWCharBuffer wbuf; if ( enc == wxFONTENCODING_SYSTEM || enc == wxFONTENCODING_DEFAULT ) {