@@ -190,7 +190,7 @@ class MainViewController: NSViewController, NSTableViewDataSource {
190190
191191 // Display Alert if /var/log/jamf.log doesn't exist
192192 guard Preferences . sharedInstance. logFileHandle != nil else {
193- if let currentWindow = self . view. window {
193+ if let currentWindow = view. window {
194194 let alert = NSAlert ( )
195195
196196 alert. alertStyle = . critical
@@ -211,9 +211,11 @@ class MainViewController: NSViewController, NSTableViewDataSource {
211211 return
212212 }
213213
214- DispatchQueue . main. async { [ unowned self] in
215- self . sendButton. isHidden = false
216- self . continueButton. isHidden = true
214+ DispatchQueue . main. async { [ weak self] in
215+ guard let strongSelf = self else { return }
216+
217+ strongSelf. sendButton. isHidden = false
218+ strongSelf. continueButton. isHidden = true
217219 }
218220
219221 webView. loadFileURL ( form, allowingReadAccessTo: Preferences . sharedInstance. assetPath)
@@ -226,8 +228,10 @@ class MainViewController: NSViewController, NSTableViewDataSource {
226228 Log . write ( string: " Form already completed. " , cat: " UserInput " , level: . debug)
227229 }
228230
229- DispatchQueue . main. async { [ unowned self] in
230- self . continueButton. isHidden = Preferences . sharedInstance. continueAction. isHidden
231+ DispatchQueue . main. async { [ weak self] in
232+ guard let strongSelf = self else { return }
233+
234+ strongSelf. continueButton. isHidden = Preferences . sharedInstance. continueAction. isHidden
231235 }
232236
233237 webView. loadFileURL ( html, allowingReadAccessTo: Preferences . sharedInstance. assetPath)
@@ -268,7 +272,9 @@ class MainViewController: NSViewController, NSTableViewDataSource {
268272 }
269273
270274 @IBAction func evalForm( _ sender: Any ) {
271- webView. evaluateJavaScript ( evaluationJavascript) { ( data: Any ? , error: Error ? ) in
275+ webView. evaluateJavaScript ( evaluationJavascript) { [ weak self] ( data: Any ? , error: Error ? ) in
276+ guard let strongSelf = self else { return }
277+
272278 if error != nil {
273279 Log . write ( string: " Error getting User Input " , cat: " UserInput " , level: . error)
274280 return
@@ -293,14 +299,14 @@ class MainViewController: NSViewController, NSTableViewDataSource {
293299 FileManager . default. createFile ( atPath: " \( item. key) .txt " , contents: ( item. value as? String ?? " " ) . data ( using: . utf8) , attributes: nil )
294300 }
295301
296- DispatchQueue . main. async { [ unowned self ] in
297- self . sendButton. isHidden = true
298- self . continueButton. isHidden = false
302+ DispatchQueue . main. async {
303+ strongSelf . sendButton. isHidden = true
304+ strongSelf . continueButton. isHidden = false
299305
300306 if let html = Preferences . sharedInstance. html {
301- self . webView. loadFileURL ( html, allowingReadAccessTo: Preferences . sharedInstance. assetPath)
307+ strongSelf . webView. loadFileURL ( html, allowingReadAccessTo: Preferences . sharedInstance. assetPath)
302308 } else {
303- self . webView. loadHTMLString ( NSLocalizedString ( " error.create_missing_bundle " ) , baseURL: nil )
309+ strongSelf . webView. loadHTMLString ( NSLocalizedString ( " error.create_missing_bundle " ) , baseURL: nil )
304310 }
305311 }
306312
0 commit comments