]> git.saurik.com Git - wxWidgets.git/commitdiff
don't crash if WriteText() argument can't be converted to UTF-8
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 23 Jul 2004 21:34:19 +0000 (21:34 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 23 Jul 2004 21:34:19 +0000 (21:34 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28442 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/textctrl.cpp
src/gtk1/textctrl.cpp

index 50783a1b0decfa14b00e97d39a9808aa7ea425b4..09059a3f0058f95fcd94b9697e0e79b286c0f4b1 100644 (file)
@@ -593,6 +593,12 @@ void wxTextCtrl::WriteText( const wxString &text )
 #else
         wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
 #endif
+        if ( !buffer )
+        {
+            // what else can we do? at least don't crash...
+            return;
+        }
+
         GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
 
         // TODO: Call whatever is needed to delete the selection.
index 50783a1b0decfa14b00e97d39a9808aa7ea425b4..09059a3f0058f95fcd94b9697e0e79b286c0f4b1 100644 (file)
@@ -593,6 +593,12 @@ void wxTextCtrl::WriteText( const wxString &text )
 #else
         wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
 #endif
+        if ( !buffer )
+        {
+            // what else can we do? at least don't crash...
+            return;
+        }
+
         GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
 
         // TODO: Call whatever is needed to delete the selection.