From ed59d6acf5bbba76075d16c7f8b9c55e868bcda1 Mon Sep 17 00:00:00 2001 From: AT <14300910+theClueless@users.noreply.github.com> Date: Sat, 9 Nov 2019 11:55:53 +0200 Subject: [PATCH] when both icopath and icon delegdate are empty\null it will raise an exception. currently delegate is verified and an error icon will be presented (same as before) but without raising an excpetion. --- Wox/ViewModel/ResultViewModel.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Wox/ViewModel/ResultViewModel.cs b/Wox/ViewModel/ResultViewModel.cs index a2ce53de2b..1d610db2fe 100644 --- a/Wox/ViewModel/ResultViewModel.cs +++ b/Wox/ViewModel/ResultViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Windows.Media; using System.Windows.Threading; +using Wox.Infrastructure; using Wox.Infrastructure.Image; using Wox.Infrastructure.Logger; using Wox.Plugin; @@ -22,7 +23,8 @@ namespace Wox.ViewModel { get { - if (string.IsNullOrEmpty(Result.IcoPath)) + var imagePath = Result.IcoPath; + if (string.IsNullOrEmpty(imagePath) && Result.Icon != null) { try { @@ -31,13 +33,12 @@ namespace Wox.ViewModel catch (Exception e) { Log.Exception($"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", e); - return ImageLoader.Load(Result.IcoPath); + imagePath = Constant.ErrorIcon; } } - else - { - return ImageLoader.Load(Result.IcoPath); - } + + // will get here either when icoPath has value\icon delegate is null\when had exception in delegate + return ImageLoader.Load(imagePath); } }