Run sanity checks on the position values.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kevin Ollivier
2009-11-11 02:11:13 +00:00
parent 17cbc2446b
commit db22fdd17d

View File

@@ -431,7 +431,7 @@ void wxNSTextViewControl::SetFont( const wxFont & font , const wxColour& WXUNUSE
bool wxNSTextViewControl::GetStyle(long position, wxTextAttr& style) 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]; NSTextStorage* storage = [m_textView textStorage];
NSFont* font = [storage attribute:NSFontAttributeName atIndex:position effectiveRange:NULL]; NSFont* font = [storage attribute:NSFontAttributeName atIndex:position effectiveRange:NULL];
if (font) if (font)