mirror of
https://github.com/nicklockwood/SwiftFormat.git
synced 2026-06-16 10:34:34 +00:00
Fix array bounds crash
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1288,7 +1288,7 @@ extension Formatter {
|
||||
endOfDeclaration = linebreakSearchIndex + 1
|
||||
}
|
||||
|
||||
let declarationRange = startOfDeclaration ... (endOfDeclaration ?? parser.tokens.count - 1)
|
||||
let declarationRange = startOfDeclaration ... min(endOfDeclaration ?? .max, parser.tokens.count - 1)
|
||||
let declaration = Array(parser.tokens[declarationRange])
|
||||
parser.removeTokens(in: declarationRange)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user