diff --git a/Tiefsee/VW/WV_RunApp.cs b/Tiefsee/VW/WV_RunApp.cs index 4012b59..de49a53 100644 --- a/Tiefsee/VW/WV_RunApp.cs +++ b/Tiefsee/VW/WV_RunApp.cs @@ -125,7 +125,13 @@ public List GetUwpList() { jsonString = sr.ReadToEnd(); } } - _tempUwpItem = JsonSerializer.Deserialize>(jsonString); + _tempUwpItem = JsonSerializer.Deserialize>(jsonString) + // 忽略異常的資料 + .Where(x => string.IsNullOrEmpty(x.Value.Name) == false && + string.IsNullOrEmpty(x.Value.Logo) == false && + string.IsNullOrEmpty(x.Value.Id) == false) + .ToDictionary(); + } catch (Exception) { _tempUwpItem = new(); @@ -145,6 +151,10 @@ public List GetUwpList() { string name = package.DisplayName; // APP在地化的名稱 (取得成本高) string logo = package.Logo.ToString(); // 圖示的路徑 (取得成本高) string id = package.Id.Name + "_" + package.Id.PublisherId; + // 忽略異常的資料 + if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(logo) || string.IsNullOrEmpty(id)) { + continue; + } _tempUwpItem.Add(fullName, new UwpItem { Logo = logo, Name = name,