Update Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

Co-authored-by: Yan Li <Yusyuriv@users.noreply.github.com>
This commit is contained in:
Jack Ye 2025-03-20 17:38:31 +08:00 committed by GitHub
parent afb38db572
commit 444d29506d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,17 +44,16 @@ namespace Flow.Launcher.Core.Plugin
// we need to convert it to the correct type
foreach (var (key, value) in Settings)
{
if (value is JsonElement jsonElement)
if (value is not JsonElement jsonElement) continue;
Settings[key] = jsonElement.ValueKind switch
{
Settings[key] = jsonElement.ValueKind switch
{
JsonValueKind.String => jsonElement.GetString() ?? value,
JsonValueKind.True => jsonElement.GetBoolean(),
JsonValueKind.False => jsonElement.GetBoolean(),
JsonValueKind.Null => null,
_ => value
};
}
JsonValueKind.String => jsonElement.GetString() ?? value,
JsonValueKind.True => jsonElement.GetBoolean(),
JsonValueKind.False => jsonElement.GetBoolean(),
JsonValueKind.Null => null,
_ => value
};
}
}