From 66478df905ddcbf94a035033dda16c1e090e33ab Mon Sep 17 00:00:00 2001 From: Econa77 Date: Fri, 2 Apr 2021 16:37:31 +0900 Subject: [PATCH] Fix out of bounds crash of truncated token replacement --- Source/Classes/Drawing/Truncation.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Classes/Drawing/Truncation.swift b/Source/Classes/Drawing/Truncation.swift index a2eac4f..02dffe8 100644 --- a/Source/Classes/Drawing/Truncation.swift +++ b/Source/Classes/Drawing/Truncation.swift @@ -48,7 +48,7 @@ extension NantesLabel { // Walk across all the lines of truncation, replacing lines starting with our last line - the number of truncation token lines we have // the first line we replace, we'll truncate it, after that, we 100% replace lines of the original string with truncation lines for (index, tokenLine) in tokenLines.enumerated() { - let originalIndex = self.numberOfLines - tokenLines.count + index + let originalIndex = lines.count - tokenLines.count + index // We want to replace every other line besides the first truncated line completely with the lines from the truncation token guard index == 0 else {