Skip to content

Commit ed59d6a

Browse files
committed
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.
1 parent d818a15 commit ed59d6a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Wox/ViewModel/ResultViewModel.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Windows.Media;
33
using System.Windows.Threading;
4+
using Wox.Infrastructure;
45
using Wox.Infrastructure.Image;
56
using Wox.Infrastructure.Logger;
67
using Wox.Plugin;
@@ -22,7 +23,8 @@ public ImageSource Image
2223
{
2324
get
2425
{
25-
if (string.IsNullOrEmpty(Result.IcoPath))
26+
var imagePath = Result.IcoPath;
27+
if (string.IsNullOrEmpty(imagePath) && Result.Icon != null)
2628
{
2729
try
2830
{
@@ -31,13 +33,12 @@ public ImageSource Image
3133
catch (Exception e)
3234
{
3335
Log.Exception($"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", e);
34-
return ImageLoader.Load(Result.IcoPath);
36+
imagePath = Constant.ErrorIcon;
3537
}
3638
}
37-
else
38-
{
39-
return ImageLoader.Load(Result.IcoPath);
40-
}
39+
40+
// will get here either when icoPath has value\icon delegate is null\when had exception in delegate
41+
return ImageLoader.Load(imagePath);
4142
}
4243
}
4344

0 commit comments

Comments
 (0)