From 643b9f4659a68a82cd22c1481f61467a742ea7ad Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Tue, 20 Oct 2020 12:05:40 -0500 Subject: [PATCH] Make sure range.location isn't out-of-bounds Fix for #2512. --- Shared/Extensions/NSAttributedString+NetNewsWire.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Shared/Extensions/NSAttributedString+NetNewsWire.swift b/Shared/Extensions/NSAttributedString+NetNewsWire.swift index f778dfb75..98fb694b7 100644 --- a/Shared/Extensions/NSAttributedString+NetNewsWire.swift +++ b/Shared/Extensions/NSAttributedString+NetNewsWire.swift @@ -191,6 +191,8 @@ extension NSAttributedString { result.addAttribute(.font, value: baseFont, range: NSRange(location: 0, length: result.length)) for (range, styles) in attributeRanges { + if range.location >= result.length { continue } + let currentFont = result.attribute(.font, at: range.location, effectiveRange: nil) as! Font let currentDescriptor = currentFont.fontDescriptor var descriptor = currentDescriptor.copy() as! FontDescriptor