mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
[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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user