From 5d4d22c18fb63aaba6b6b01c7816757e564dad3a Mon Sep 17 00:00:00 2001 From: wlux Date: Wed, 23 Dec 2009 01:01:57 +0000 Subject: [PATCH] Prevent a crash when -selectedRange is called for an NSTextView without a layout manager. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29165 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 3 +++ Source/NSTextView.m | 2 ++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8ba0ef6f5..b7efc55b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ -shouldChangeTextInRange:replacementString:): Implement coalescing of undo actions for typing events. + * Source/NSTextView.m (-selectedRange): Prevent crash when the + receiver has no layout manager. + 2009-12-23 Wolfgang Lux * Source/NSTableView.m (-mouseDown:): A single click into a cell diff --git a/Source/NSTextView.m b/Source/NSTextView.m index 3a2309399..02c0bf5fd 100644 --- a/Source/NSTextView.m +++ b/Source/NSTextView.m @@ -2900,6 +2900,8 @@ Scroll so that the beginning of the range is visible. - (NSRange) selectedRange { + if (!_layoutManager) + return NSMakeRange(0, 0); return _layoutManager->_selected_range; }