From: Kevin Ollivier Date: Wed, 11 Nov 2009 02:11:13 +0000 (+0000) Subject: Run sanity checks on the position values. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/db22fdd17d2854cbcbf38de80f0c1e07f203a080 Run sanity checks on the position values. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index e0bdfdfd20..3a0f1c1979 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -431,7 +431,7 @@ void wxNSTextViewControl::SetFont( const wxFont & font , const wxColour& WXUNUSE bool wxNSTextViewControl::GetStyle(long position, wxTextAttr& style) { - if (m_textView) { + if (m_textView && position >=0 && position < [[m_textView string] length]) { NSTextStorage* storage = [m_textView textStorage]; NSFont* font = [storage attribute:NSFontAttributeName atIndex:position effectiveRange:NULL]; if (font)