Avoid force-unwrapping, which was causing a crash. Add an `assertionFailure` so we can catch this issue in the act — we need to know why an item would not be a Node. Fix https://github.com/Ranchero-Software/NetNewsWire/issues/3824

This commit is contained in:
Brent Simmons 2023-01-22 14:57:56 -08:00
parent 489088ad74
commit 06910b1e58
1 changed files with 4 additions and 1 deletions

View File

@ -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
}