From 06910b1e5865617f1c1552896e92eab32221c430 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 22 Jan 2023 14:57:56 -0800 Subject: [PATCH] =?UTF-8?q?Avoid=20force-unwrapping,=20which=20was=20causi?= =?UTF-8?q?ng=20a=20crash.=20Add=20an=20`assertionFailure`=20so=20we=20can?= =?UTF-8?q?=20catch=20this=20issue=20in=20the=20act=20=E2=80=94=C2=A0we=20?= =?UTF-8?q?need=20to=20know=20why=20an=20item=20would=20not=20be=20a=20Nod?= =?UTF-8?q?e.=20Fix=20https://github.com/Ranchero-Software/NetNewsWire/iss?= =?UTF-8?q?ues/3824?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mac/MainWindow/Sidebar/SidebarViewController.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Mac/MainWindow/Sidebar/SidebarViewController.swift b/Mac/MainWindow/Sidebar/SidebarViewController.swift index 99b33cb90..26077cae8 100644 --- a/Mac/MainWindow/Sidebar/SidebarViewController.swift +++ b/Mac/MainWindow/Sidebar/SidebarViewController.swift @@ -371,7 +371,10 @@ protocol SidebarDelegate: AnyObject { } func outlineView(_ outlineView: NSOutlineView, isGroupItem item: Any) -> Bool { - let node = item as! Node + guard let node = item as? Node else { + assertionFailure("Expected item to be a Node.") + return false + } return node.isGroupItem }