Merge pull request #2960 from mrcarlberg/cptextview_exposedrect

Fixed: Prevent crash in CPTextView when _exposedRect is nil
This commit is contained in:
cacaodev
2020-12-19 15:19:19 +01:00
committed by GitHub
+1 -1
View File
@@ -1124,7 +1124,7 @@ Sets the selection to a range of characters in response to user action.
// dragging the selection
if ([self selectionGranularity] == CPSelectByCharacter && CPLocationInRange(_startTrackingLocation, _selectionRange))
{
var visibleRange = [_layoutManager glyphRangeForBoundingRect:_exposedRect inTextContainer:_textContainer],
var visibleRange = [_layoutManager glyphRangeForBoundingRect:[self exposedRect] inTextContainer:_textContainer],
firstFragment = [_layoutManager _firstLineFragmentForLineFromLocation:_selectionRange.location],
lastFragment = [_layoutManager _lastLineFragmentForLineFromLocation:CPMaxRange(_selectionRange)],
lineBeginningIndex = firstFragment._range.location,