Skip to content

Commit c9dbc33

Browse files
authored
Merge pull request #4355 from Flow-Launcher/PluginManager_Null
Ensure plugin manifest is non-nullable
2 parents 86d7c1e + 015c32e commit c9dbc33

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,12 @@ public interface IPublicAPI
533533
public Task<bool> UpdatePluginManifestAsync(bool usePrimaryUrlOnly = false, CancellationToken token = default);
534534

535535
/// <summary>
536-
/// Get the plugin manifest.
536+
/// Get the current plugin manifest entries known to Flow Launcher.
537537
/// </summary>
538-
/// <remarks>
539-
/// If Flow cannot get manifest data, this could be null
540-
/// </remarks>
541-
/// <returns></returns>
538+
/// <returns>
539+
/// A non-null read-only list of <see cref="UserPlugin"/> entries. The list may be empty if the
540+
/// manifest has not been loaded yet, or if no successful manifest fetch has completed in the current session.
541+
/// </returns>
542542
public IReadOnlyList<UserPlugin> GetPluginManifest();
543543

544544
/// <summary>

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Concurrent;
33
using System.Collections.Generic;
44
using System.Collections.Specialized;
@@ -583,7 +583,7 @@ public ValueTask<ImageSource> LoadImageAsync(string path, bool loadFullImage = f
583583
public Task<bool> UpdatePluginManifestAsync(bool usePrimaryUrlOnly = false, CancellationToken token = default) =>
584584
PluginsManifest.UpdateManifestAsync(usePrimaryUrlOnly, token);
585585

586-
public IReadOnlyList<UserPlugin> GetPluginManifest() => PluginsManifest.UserPlugins;
586+
public IReadOnlyList<UserPlugin> GetPluginManifest() => PluginsManifest.UserPlugins ?? [];
587587

588588
public bool PluginModified(string id) => PluginManager.PluginModified(id);
589589

Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public bool ShowExecutable
8282
}
8383
}
8484

85-
public IList<PluginStoreItemViewModel> ExternalPlugins => App.API.GetPluginManifest()?
85+
public IList<PluginStoreItemViewModel> ExternalPlugins => App.API.GetPluginManifest()
8686
.Select(p => new PluginStoreItemViewModel(p))
8787
.OrderByDescending(p => p.Category == PluginStoreItemViewModel.NewRelease)
8888
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.RecentlyUpdated)

0 commit comments

Comments
 (0)