Skip to content

Commit 590bf20

Browse files
committed
Add null check for plugin metadata deserialization
Throw a JsonException if deserializing plugin metadata from JSON returns null. This prevents null metadata from being used and improves error handling for invalid or corrupted plugin.json files.
1 parent b02a5a2 commit 590bf20

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,8 @@ internal static bool InstallPlugin(UserPlugin plugin, string zipFilePath, bool c
899899
PluginMetadata newMetadata;
900900
try
901901
{
902-
newMetadata = JsonSerializer.Deserialize<PluginMetadata>(File.ReadAllText(metadataJsonFilePath));
902+
newMetadata = JsonSerializer.Deserialize<PluginMetadata>(File.ReadAllText(metadataJsonFilePath)) ??
903+
throw new JsonException("Deserialized metadata is null");
903904
}
904905
catch (Exception ex)
905906
{

0 commit comments

Comments
 (0)