From 69c00d272bed73dbfbeea805bd9a3663ff84e283 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Fri, 19 Aug 2016 23:15:40 +0100 Subject: [PATCH] Fix can't find file exception caused by abnormal scale --- .../Wox.Plugin.Program/ProgramSources/UWP.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/UWP.cs b/Plugins/Wox.Plugin.Program/ProgramSources/UWP.cs index adf9c0a359..f10abcb866 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/UWP.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/UWP.cs @@ -235,9 +235,21 @@ namespace Wox.Plugin.Program.ProgramSources // todo: remove hard cod scale var path1 = $"{filename}.scale-200{extension}"; var path2 = $"{filename}.scale-100{extension}"; - var uri = File.Exists(path1) ? new Uri(path1) : new Uri(path2); - var image = new BitmapImage(uri); - return image; + if (File.Exists(path1)) + { + var image = new BitmapImage(new Uri(path1)); + return image; + } + else if (File.Exists(path2)) + { + var image = new BitmapImage(new Uri(path2)); + return image; + } + else + { + // todo: replaced with wox error logo + return new BitmapImage(); + } } private BitmapImage ImageFromStream(RandomAccessStreamReference reference)