From d2ca74ecdfdf716a703dd5e4cfd9ded270018157 Mon Sep 17 00:00:00 2001 From: AT <14300910+theClueless@users.noreply.github.com> Date: Fri, 1 Nov 2019 21:44:55 +0200 Subject: [PATCH] added protection when creating uwp --- Plugins/Wox.Plugin.Program/Programs/UWP.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/Programs/UWP.cs b/Plugins/Wox.Plugin.Program/Programs/UWP.cs index 360b744319..d511888ab0 100644 --- a/Plugins/Wox.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Wox.Plugin.Program/Programs/UWP.cs @@ -196,11 +196,20 @@ namespace Wox.Plugin.Program.Programs ps = ps.Where(p => { bool valid; + try + { + var f = p.IsFramework; + var d = p.IsDevelopmentMode; + var path = p.InstalledLocation.Path; + valid = !f && !d && !string.IsNullOrEmpty(path); + } + catch (Exception e) + { + ProgramLogger.LogException("|UWP|CurrentUserPackages|An unexpected error occured and " + + $"unable to verify if package is valid", e); + return false; + } - var f = p.IsFramework; - var d = p.IsDevelopmentMode; - var path = p.InstalledLocation.Path; - valid = !f && !d && !string.IsNullOrEmpty(path); return valid; });