From 91d42bf7a5f5a7c2fd217be7ed468565cb5e16ad Mon Sep 17 00:00:00 2001 From: Jorge Leandro Perez Date: Thu, 6 Jun 2024 16:57:05 -0300 Subject: [PATCH] SPNoteListViewController+Extensions: Prevents force unwrap a nil property --- .../Classes/SPNoteListViewController+Extensions.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Simplenote/Classes/SPNoteListViewController+Extensions.swift b/Simplenote/Classes/SPNoteListViewController+Extensions.swift index c7478e309..dbd1d8eff 100644 --- a/Simplenote/Classes/SPNoteListViewController+Extensions.swift +++ b/Simplenote/Classes/SPNoteListViewController+Extensions.swift @@ -700,10 +700,12 @@ extension SPNoteListViewController { @objc func restoreSelectedRowsAfterBackgrounding() { - if selectedNotesEnteringBackground.isEmpty == false { - selectRows(with: selectedNotesEnteringBackground) - selectedNotesEnteringBackground.removeAll() + guard let selectedNotesEnteringBackground, selectedNotesEnteringBackground.isEmpty == false else { + return } + + selectRows(with: selectedNotesEnteringBackground) + self.selectedNotesEnteringBackground = [] } func selectRows(with indexPaths: [IndexPath]) {