mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Catch exception in ShellLinkHelper
This commit is contained in:
parent
207b29f816
commit
e6b8a0dde2
2 changed files with 14 additions and 12 deletions
|
|
@ -3,6 +3,7 @@ using System.Text;
|
|||
using System.Runtime.InteropServices;
|
||||
using Accessibility;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using Flow.Launcher.Plugin.Program.Logger;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Program.Programs
|
||||
{
|
||||
|
|
@ -119,9 +120,19 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
// To set the app description
|
||||
if (!String.IsNullOrEmpty(target))
|
||||
{
|
||||
buffer = new StringBuilder(MAX_PATH);
|
||||
((IShellLinkW)link).GetDescription(buffer, MAX_PATH);
|
||||
description = buffer.ToString();
|
||||
try
|
||||
{
|
||||
buffer = new StringBuilder(MAX_PATH);
|
||||
((IShellLinkW)link).GetDescription(buffer, MAX_PATH);
|
||||
description = buffer.ToString();
|
||||
}
|
||||
catch (COMException e)
|
||||
{
|
||||
// C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\MiracastView.lnk always cause exception
|
||||
ProgramLogger.LogException($"|IShellLinkW|retrieveTargetPath|{path}" +
|
||||
"|Error caused likely due to trying to get the description of the program",
|
||||
e);
|
||||
}
|
||||
|
||||
buffer.Clear();
|
||||
((IShellLinkW)link).GetArguments(buffer, MAX_PATH);
|
||||
|
|
|
|||
|
|
@ -309,15 +309,6 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
|
||||
return program;
|
||||
}
|
||||
catch (COMException e)
|
||||
{
|
||||
// C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\MiracastView.lnk always cause exception
|
||||
ProgramLogger.LogException($"|Win32|LnkProgram|{path}" +
|
||||
"|Error caused likely due to trying to get the description of the program",
|
||||
e);
|
||||
|
||||
return Default;
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
ProgramLogger.LogException($"|Win32|LnkProgram|{path}" +
|
||||
|
|
|
|||
Loading…
Reference in a new issue