Check index availablity in brace match with Swift.String.Index

This commit is contained in:
1024jp 2023-12-30 11:32:46 +09:00
parent f494572f55
commit 2cd2e25c5e
2 changed files with 2 additions and 1 deletions

View File

@ -14,6 +14,7 @@
- Fix an issue that the application could not open a document containing a specific pattern of letters.
- Fix a possible crash when opening a corrupt file.
- Fix a possible crash when moving the cursor in the editor.
- Fix an issue that the validation error message in the syntax editor did not change even when errors were found.

View File

@ -37,8 +37,8 @@ extension NSTextView {
let cursorIndexes = selectedRanges
.filter { $0.isEmpty }
.filter { $0.location > 0 }
.map { String.Index(utf16Offset: $0.lowerBound, in: self.string) }
.filter { $0 > self.string.startIndex }
guard
!cursorIndexes.isEmpty,