From dca93cb6f0c5f069861809e2c2b1f2a89dc80908 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Fri, 18 Nov 2022 16:12:49 +0800 Subject: [PATCH] PrefUI & PrefWindow // Stop force-unwrapping AppDelegate. --- Source/Modules/UIModules/PrefUI/VwrPrefPaneDictionary.swift | 2 +- Source/Modules/WindowControllers/CtlPrefWindow.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Modules/UIModules/PrefUI/VwrPrefPaneDictionary.swift b/Source/Modules/UIModules/PrefUI/VwrPrefPaneDictionary.swift index a8300f0d..cc7ccb35 100644 --- a/Source/Modules/UIModules/PrefUI/VwrPrefPaneDictionary.swift +++ b/Source/Modules/UIModules/PrefUI/VwrPrefPaneDictionary.swift @@ -88,7 +88,7 @@ struct VwrPrefPaneDictionary: View { PrefMgr.shared.userDataFolderSpecified = newPath tbxUserDataPathSpecified = PrefMgr.shared.userDataFolderSpecified BookmarkManager.shared.saveBookmark(for: url) - (NSApp.delegate as! AppDelegate).updateDirectoryMonitorPath() + (NSApp.delegate as? AppDelegate)?.updateDirectoryMonitorPath() } else { IMEApp.buzz() if !bolPreviousFolderValidity { diff --git a/Source/Modules/WindowControllers/CtlPrefWindow.swift b/Source/Modules/WindowControllers/CtlPrefWindow.swift index 33d54bef..743eaf43 100644 --- a/Source/Modules/WindowControllers/CtlPrefWindow.swift +++ b/Source/Modules/WindowControllers/CtlPrefWindow.swift @@ -263,7 +263,7 @@ class CtlPrefWindow: NSWindowController { if LMMgr.checkIfSpecifiedUserDataFolderValid(newPath) { PrefMgr.shared.userDataFolderSpecified = newPath BookmarkManager.shared.saveBookmark(for: url) - (NSApp.delegate as! AppDelegate).updateDirectoryMonitorPath() + (NSApp.delegate as? AppDelegate)?.updateDirectoryMonitorPath() } else { IMEApp.buzz() if !bolPreviousFolderValidity {