From ea8c9e0386155fe3c50328bd95799421aed9ade6 Mon Sep 17 00:00:00 2001 From: tisfeng Date: Mon, 8 Jan 2024 22:56:02 +0800 Subject: [PATCH] fix: serviceTypes count is greater than services count, cause crash --- Easydict/NewApp/View/SettingView/Tabs/ServiceTab.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Easydict/NewApp/View/SettingView/Tabs/ServiceTab.swift b/Easydict/NewApp/View/SettingView/Tabs/ServiceTab.swift index 2cb904369..f67f3bf49 100644 --- a/Easydict/NewApp/View/SettingView/Tabs/ServiceTab.swift +++ b/Easydict/NewApp/View/SettingView/Tabs/ServiceTab.swift @@ -75,8 +75,10 @@ struct ServiceTab: View { func loadService(type: Int) { let windowType = EZWindowType(rawValue: type) ?? .none - serviceTypes = EZLocalStorage.shared().allServiceTypes(windowType) services = EZLocalStorage.shared().allServices(windowType) + serviceTypes = services.map { service in + service.serviceType() + } } func serviceToggled(index: Int, isEnable: Bool) {