From c19dba69982802eb5201a5ba9195f424ff93fb1d Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 27 Dec 2017 18:00:17 -0800 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20crash=20when=20cellAppearance?= =?UTF-8?q?=20is=20nil.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Evergreen/MainWindow/Sidebar/Cell/SidebarCell.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Evergreen/MainWindow/Sidebar/Cell/SidebarCell.swift b/Evergreen/MainWindow/Sidebar/Cell/SidebarCell.swift index 29a149366..428a861b8 100644 --- a/Evergreen/MainWindow/Sidebar/Cell/SidebarCell.swift +++ b/Evergreen/MainWindow/Sidebar/Cell/SidebarCell.swift @@ -37,7 +37,7 @@ class SidebarCell : NSTableCellView { private let unreadCountView = UnreadCountView(frame: NSZeroRect) - var cellAppearance: SidebarCellAppearance! { + var cellAppearance: SidebarCellAppearance? { didSet { if cellAppearance != oldValue { needsLayout = true @@ -105,7 +105,7 @@ class SidebarCell : NSTableCellView { override func resizeSubviews(withOldSize oldSize: NSSize) { - guard let textField = textField else { + guard let textField = textField, let cellAppearance = cellAppearance else { return } let layout = SidebarCellLayout(appearance: cellAppearance, cellSize: bounds.size, shouldShowImage: shouldShowImage, textField: textField, unreadCountView: unreadCountView)