From 5451f1edca57afc50412e798195b92cae105b9fd Mon Sep 17 00:00:00 2001 From: sebjvidal Date: Thu, 16 Nov 2023 09:48:55 +0000 Subject: [PATCH] Fix crash in `Coordinator.swift` --- Sources/NeonPlugin/Coordinator.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/NeonPlugin/Coordinator.swift b/Sources/NeonPlugin/Coordinator.swift index bb0dafe..e8a4442 100644 --- a/Sources/NeonPlugin/Coordinator.swift +++ b/Sources/NeonPlugin/Coordinator.swift @@ -73,7 +73,8 @@ public class Coordinator { } return tsClient.tokenProvider(with: highlightsQuery) { range, _ in - textContentManager.attributedString(in: NSTextRange(range, provider: textContentManager))?.string + guard range.isEmpty == false else { return nil } + return textContentManager.attributedString(in: NSTextRange(range, provider: textContentManager))?.string } }