Skip to content

Commit d7a5c50

Browse files
Update crashlytics/Shared/ReachabililtyHelper.swift
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent bf5cb75 commit d7a5c50

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

crashlytics/Shared/ReachabililtyHelper.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ class ReachabililtyHelper: NSObject {
6060
* Add a hook to update network status going forward.
6161
*/
6262
func updateAndTrackNetworkStatus() {
63-
monitor.pathUpdateHandler = { path in
64-
let status = self.networkStatus(from: path)
65-
Crashlytics.crashlytics().setCustomValue(status, forKey: "network_connection")
66-
}
63+
monitor.pathUpdateHandler = { [weak self] path in
64+
guard let self = self else { return }
65+
let status = self.networkStatus(from: path)
66+
Crashlytics.crashlytics().setCustomValue(status, forKey: "network_connection")
67+
}
6768
let queue = DispatchQueue(label: "NetworkMonitor")
6869
monitor.start(queue: queue)
6970
}

0 commit comments

Comments
 (0)