From f728e6144f7a0f2e94dd1089ea443cd9dfa2b607 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 12 Jul 2021 18:10:40 -0400 Subject: [PATCH] Fix TODO. --- Clocker/Events and Reminders/CalendarHandler.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Clocker/Events and Reminders/CalendarHandler.swift b/Clocker/Events and Reminders/CalendarHandler.swift index a0b1e2b..e14590b 100644 --- a/Clocker/Events and Reminders/CalendarHandler.swift +++ b/Clocker/Events and Reminders/CalendarHandler.swift @@ -392,8 +392,14 @@ extension EventCenter { private func retrieveMeetingURL(_ event: EKEvent) -> URL? { if EventCenter.dataDetector == nil { - // TODO: Handle Try-Catch gracefully - EventCenter.dataDetector = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) + var dataDetector: NSDataDetector? = nil + do { + dataDetector = try NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) + } catch { + assertionFailure("Unable to create a link-type data detector") + return nil + } + EventCenter.dataDetector = dataDetector } if let location = event.location {