From a9181a0184a4175e7ad92fcc06ab222778aea838 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Wed, 25 May 2022 16:46:55 +0100 Subject: [PATCH] [PTRun][WebSearch]Fix empty browser pattern crash (#18480) --- src/modules/launcher/Wox.Infrastructure/Helper.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/launcher/Wox.Infrastructure/Helper.cs b/src/modules/launcher/Wox.Infrastructure/Helper.cs index 65daea49ea..e8360655d8 100644 --- a/src/modules/launcher/Wox.Infrastructure/Helper.cs +++ b/src/modules/launcher/Wox.Infrastructure/Helper.cs @@ -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); }