[cmdpal] Fix calculator error when pressing Space (#39679)

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
This commit is contained in:
Yu Leng
2025-05-26 11:37:38 +08:00
committed by GitHub
parent a804bf86a4
commit 718e725571
4 changed files with 18 additions and 1 deletions

View File

@@ -35,7 +35,7 @@ public static class CalculateHelper
{
if (string.IsNullOrWhiteSpace(input))
{
throw new ArgumentNullException(paramName: nameof(input));
return false;
}
if (!RegValidExpressChar.IsMatch(input))

View File

@@ -32,6 +32,11 @@ public static partial class QueryHelper
NumberTranslator translator = NumberTranslator.Create(inputCulture, new CultureInfo("en-US"));
var input = translator.Translate(query.Normalize(NormalizationForm.FormKC));
if (string.IsNullOrWhiteSpace(input))
{
return ErrorHandler.OnError(isFallbackSearch, query, Properties.Resources.calculator_expression_empty);
}
if (!CalculateHelper.InputValid(input))
{
return null;