From bde9aade1173a8a466e3d54e2adc39bea49efe97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Wed, 28 Aug 2024 15:39:03 +0200 Subject: [PATCH] fixed some potential crashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Toni Förster --- Model/Store.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Model/Store.swift b/Model/Store.swift index 67e0eee8..3f27eadc 100644 --- a/Model/Store.swift +++ b/Model/Store.swift @@ -20,10 +20,16 @@ final class Store: ResourceObserver, ObservableObject { } func replace(_ items: Data) { - all = items + // Ensure the change happens on the main thread + DispatchQueue.main.async { + self.all = items + } } func clear() { - all = nil + // Ensure clearing happens on the main thread + DispatchQueue.main.async { + self.all = nil + } } }