[PTRun][WebSearch]Fix empty browser pattern crash (#18480)

This commit is contained in:
Jaime Bernardo 2022-05-25 16:46:55 +01:00 committed by GitHub
parent f9e967973e
commit a9181a0184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,7 +150,11 @@ namespace Wox.Infrastructure
public static bool OpenCommandInShell(string path, string pattern, string arguments, string workingDir = null, ShellRunAsType runAs = ShellRunAsType.None, bool runWithHiddenWindow = false)
{
if (pattern.Contains("%1", StringComparison.Ordinal))
if (string.IsNullOrEmpty(pattern))
{
Log.Warn("Trying to run OpenCommandInShell with an empty pattern. The default browser definition might have issues.", typeof(Helper));
}
else if (pattern.Contains("%1", StringComparison.Ordinal))
{
arguments = pattern.Replace("%1", arguments);
}