diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 1443e57779..b9671b2850 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -943,6 +943,10 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const if ( m_windowStyle & wxTE_MULTILINE ) { GtkTextIter iter; + + if (pos > GetLastPosition()) + return false; + gtk_text_buffer_get_iter_at_offset(m_buffer, &iter, pos); if ( y )