     /// open Script menu folder in Finder
     @IBAction func openScriptFolder(_ sender: Any?) {
         
-        NSWorkspace.shared.selectFile(nil, inFileViewerRootedAtPath: self.scriptsDirectoryURL.path)
+        guard let dicrectoryURL = self.scriptsDirectoryURL else { return }
+        
+        NSWorkspace.shared.selectFile(nil, inFileViewerRootedAtPath: dicrectoryURL.path)
     }
     
     

    
    // MARK: Private Properties
    
    private let scriptsDirectoryURL: URL
    private var scriptHandlersTable: [ScriptingEventType: [EventScript]] = [:]
    
    private lazy var menuBuildingTask = Debouncer(delay: .milliseconds(200)) { [weak self] in self?.buildScriptMenu() }

    
    private override init() {
        
        do {
            self.scriptsDirectoryURL = try FileManager.default.url(for: .applicationScriptsDirectory,
                                                                   in: .userDomainMask, appropriateFor: nil, create: true)
        } catch {
            assertionFailure("cannot create the scripts folder: \(error.localizedDescription)")
            self.scriptsDirectoryURL = nil
        }
        
        self.presentedItemURL = self.scriptsDirectoryURL
