From e914798f05c6402a460c9adf1d6a04bc6b492cc2 Mon Sep 17 00:00:00 2001 From: Antonio Favata Date: Mon, 11 Nov 2024 13:10:47 +0000 Subject: [PATCH] Dispatch failure on main queue to prevent crash --- Sources/CodeScanner/ScannerViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/CodeScanner/ScannerViewController.swift b/Sources/CodeScanner/ScannerViewController.swift index 8241115..1b097bb 100644 --- a/Sources/CodeScanner/ScannerViewController.swift +++ b/Sources/CodeScanner/ScannerViewController.swift @@ -425,7 +425,9 @@ extension CodeScannerView { } func didFail(reason: ScanError) { - parentView.completion(.failure(reason)) + DispatchQueue.main.async { + parentView.completion(.failure(reason)) + } } }