Skip to content

Commit b224cfd

Browse files
committed
Crash fix for network changes while fetching info
The continuation was being called twice, which could result in a crash. Cancelling the network monitor before we resume should give us some resillience to this (but may not be a 100% fix).
1 parent f5af05b commit b224cfd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

WooCommerce/Classes/Tools/BackgroundTasks/BackgroundTaskRefreshDispatcher.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ private struct BackgroundTaskSystemInfo {
177177
let monitor = NWPathMonitor()
178178

179179
monitor.pathUpdateHandler = { path in
180-
continuation.resume(returning: NetworkInfo(path: path))
181180
monitor.cancel()
181+
continuation.resume(returning: NetworkInfo(path: path))
182182
}
183183

184184
let queue = DispatchQueue(label: "network.monitor.queue")

0 commit comments

Comments
 (0)