Skip to content

Commit

Permalink
[PTRun][Calculator]Error check when loading trigonometry mode (micros…
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimecbernardo authored and daverayment committed Jan 26, 2025
1 parent 7c271d5 commit 1bcb845
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Microsoft.PowerToys.Run.Plugin.Calculator.Properties;
using Microsoft.PowerToys.Settings.UI.Library;
using Wox.Plugin;
using Wox.Plugin.Logger;

namespace Microsoft.PowerToys.Run.Plugin.Calculator
{
Expand Down Expand Up @@ -212,8 +213,18 @@ public void UpdateSettings(PowerLauncherPluginSettings settings)
var optionReplaceInput = settings.AdditionalOptions.FirstOrDefault(x => x.Key == ReplaceInput);
replaceInput = optionReplaceInput?.Value ?? replaceInput;

var optionTrigMode = settings.AdditionalOptions.FirstOrDefault(x => x.Key == TrigMode);
trigMode = (CalculateEngine.TrigMode)int.Parse(optionTrigMode.ComboBoxValue.ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture);
try
{
var optionTrigMode = settings.AdditionalOptions.FirstOrDefault(x => x.Key == TrigMode);
if (optionTrigMode != null)
{
trigMode = (CalculateEngine.TrigMode)int.Parse(optionTrigMode.ComboBoxValue.ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture);
}
}
catch (Exception ex)
{
Log.Exception("Error while trying to load Trigonometry Mode setting: {ex.Message}", ex, GetType());
}
}

_inputUseEnglishFormat = inputUseEnglishFormat;
Expand Down

0 comments on commit 1bcb845

Please sign in to comment.