From d3a52c53fa3427e7b206178b531dcfc041b0daa5 Mon Sep 17 00:00:00 2001 From: Dmitry Kovba Date: Thu, 26 Mar 2026 16:39:26 -0700 Subject: [PATCH] Fix a compilation error (#1346) ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation update ## Motivation and Context Build fails with: > - note: closure captures reference to mutable var 'self' which is accessible to code in the current task > - error: passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure [#SendingClosureRisksDataRace] ## Testing - [x] Tested locally - [ ] Added/updated tests - [ ] Added/updated docs --- Sources/Helpers/APIServer/LocalhostDNSHandler.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Helpers/APIServer/LocalhostDNSHandler.swift b/Sources/Helpers/APIServer/LocalhostDNSHandler.swift index 4dfa7216..d7658769 100644 --- a/Sources/Helpers/APIServer/LocalhostDNSHandler.swift +++ b/Sources/Helpers/APIServer/LocalhostDNSHandler.swift @@ -55,7 +55,9 @@ actor LocalhostDNSHandler: DNSHandler { dns[dnsName] = ipv4 } } - Task { await self?.updateDNS(dns) } + if let self { + Task { await self.updateDNS(dns) } + } } }