Ignore null value in deserialization to avoid unexpected nullreference issue

This commit is contained in:
Kevin Zhang 2021-07-05 11:47:56 +08:00
parent 908d1c4124
commit c7cfd25817

View file

@ -50,6 +50,7 @@ namespace Flow.Launcher.Core.Plugin
private static readonly JsonSerializerOptions options = new()
{
PropertyNameCaseInsensitive = true,
IgnoreNullValues = true,
Converters =
{
new JsonObjectConverter()
@ -63,6 +64,8 @@ namespace Flow.Launcher.Core.Plugin
var queryResponseModel = await
JsonSerializer.DeserializeAsync<JsonRPCQueryResponseModel>(output, options);
await output.DisposeAsync();
return ParseResults(queryResponseModel);
}