[PTRun]ImageCache getter KeyNotFoundException fix (#27405)

* [PTRun] Replace direct dictionary access with TryGetValue in ImageCache getter for KeyNotFoundException fix.

* [PTRun] - Log added to ImageCache getter.
- Lock mechanism added to GetLocalizedName.

* [PTRun] Lock mechanism added to GetLocalizedName. Revert
This commit is contained in:
gokcekantarci
2023-07-24 15:08:39 +03:00
committed by GitHub
parent 4bf031d28f
commit a97e59396d

View File

@@ -9,6 +9,7 @@ using System.Linq;
using System.Windows.Media;
using Wox.Infrastructure.Storage;
using Wox.Plugin;
using Wox.Plugin.Logger;
namespace Wox.Infrastructure.Image
{
@@ -34,7 +35,13 @@ namespace Wox.Infrastructure.Image
get
{
Usage.AddOrUpdate(path, 1, (k, v) => v + 1);
var i = _data[path];
_data.TryGetValue(path, out ImageSource i);
if (i == null)
{
Log.Warn($"ImageSource is null for path: {path}", GetType());
}
return i;
}