Make sure window is non-nil before using it — don’t force-unwrap it. Fix #3827.

This commit is contained in:
Brent Simmons committed 2025-09-16 11:02:41 -07:00
1 parent 4b7ea6d920
commit 718204e4d8
9 files changed
+48 -19

No files matched your search

@@ -23,10 +23,12 @@ final class AddFolderWindowController : NSWindowController {
// MARK: - API
func runSheetOnWindow(_ w: NSWindow) {
hostWindow = w
hostWindow!.beginSheet(window!) { (returnCode: NSApplication.ModalResponse) -> Void in
func runSheetOnWindow(_ hostWindow: NSWindow) {
guard let window else {
return
}
hostWindow.beginSheet(window) { (returnCode: NSApplication.ModalResponse) -> Void in
if returnCode == NSApplication.ModalResponse.OK {
self.addFolderIfNeeded()
}