]> git.saurik.com Git - wxWidgets.git/commitdiff
Run sanity checks on the position values.
authorKevin Ollivier <kevino@theolliviers.com>
Wed, 11 Nov 2009 02:11:13 +0000 (02:11 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Wed, 11 Nov 2009 02:11:13 +0000 (02:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/textctrl.mm

index e0bdfdfd20cb7544c0997f7a9ae7fd65d46be696..3a0f1c19790c44b67ddbcb3bf3fbd666d644b8d5 100644 (file)
@@ -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)