Fixes null reference exception. (#3436)

This commit is contained in:
pekspro
2020-06-12 20:42:13 +02:00
committed by GitHub
parent 302df56ee1
commit e8c5f3a882

View File

@@ -38,6 +38,12 @@ namespace Microsoft.Plugin.Calculator
{
var result = MagesEngine.Interpret(query.Search);
// This could happen for some incorrect queries, like pi(2)
if(result == null)
{
return new List<Result>();
}
if (result.ToString() == "NaN")
result = Context.API.GetTranslation("wox_plugin_calculator_not_a_number");