We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f1fdad commit f8433f3Copy full SHA for f8433f3
1 file changed
Sources/CodeEditSourceEditor/LineFolding/Model/LineFoldCalculator.swift
@@ -101,7 +101,8 @@ class LineFoldCalculator {
101
var results: [(index: Int, foldDepth: Int)] = []
102
var count = 0
103
while count < 50, let linePosition = iterator.next() {
104
- guard let substring = textView.textStorage.substring(from: linePosition.range) as NSString?,
+ guard textView.textStorage.length <= linePosition.range.max,
105
+ let substring = textView.textStorage.substring(from: linePosition.range) as NSString?,
106
let foldDepth = foldProvider.foldLevelAtLine(
107
linePosition.index,
108
substring: substring
0 commit comments