Browse Source

another 'guard let self'

B. Petersen 5 năm trước cách đây
mục cha
commit
03bb850679
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      deltachat-ios/Handler/DeviceContactsHandler.swift

+ 4 - 3
deltachat-ios/Handler/DeviceContactsHandler.swift

@@ -86,14 +86,15 @@ class DeviceContactsHandler {
             contactListDelegate?.accessDenied()
         case .restricted, .notDetermined:
             store.requestAccess(for: .contacts) { [weak self] granted, _ in
+                guard let self = self else { return }
                 if granted {
                     DispatchQueue.main.async {
-                        self?.addContactsToCore()
-                        self?.contactListDelegate?.accessGranted()
+                        self.addContactsToCore()
+                        self.contactListDelegate?.accessGranted()
                     }
                 } else {
                     DispatchQueue.main.async {
-                        self?.contactListDelegate?.accessDenied()
+                        self.contactListDelegate?.accessDenied()
                     }
                 }
             }