From c67257e6b90090a3607e684e1a5a6631f53d25d6 Mon Sep 17 00:00:00 2001 From: Precious OSSAI <111347791+precious-ossai-cko@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:57:09 +0100 Subject: [PATCH] chore: add check for self in timeout wrapper Co-authored-by: Ehab Al <102961713+ehab-al-cko@users.noreply.github.com> --- Sources/Risk/Risk.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/Risk/Risk.swift b/Sources/Risk/Risk.swift index 1b5ae49..2c29cf4 100644 --- a/Sources/Risk/Risk.swift +++ b/Sources/Risk/Risk.swift @@ -53,7 +53,8 @@ public final class Risk { DispatchQueue.main.async { // Timer setup remains on the main queue - self.timer = Timer.scheduledTimer(withTimeInterval: self.fingerprintTimeoutInterval, repeats: false) { _ in // 3.00 + self.timer = Timer.scheduledTimer(withTimeInterval: self.fingerprintTimeoutInterval, repeats: false) { [weak self] _ in // 3.00 + guard let self else { return } self.loggerService.log(riskEvent: .publishFailure, blockTime: self.blockTime, deviceDataPersistTime: nil, fpLoadTime: fingerprintService.fpLoadTime, fpPublishTime: nil, deviceSessionId: nil, requestId: nil, error: RiskLogError(reason: "publishData", message: RiskError.Publish.fingerprintTimeout.localizedDescription, status: nil, type: "Timeout")) completion(.failure(.fingerprintTimeout))