File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
Flow.Launcher.Core/ExternalPlugins Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,12 @@ namespace Flow.Launcher.Core.ExternalPlugins
1616{
1717 public record CommunityPluginSource ( string ManifestFileUrl )
1818 {
19+ private static readonly string ClassName = nameof ( CommunityPluginSource ) ;
20+
1921 // We should not initialize API in static constructor because it will create another API instance
2022 private static IPublicAPI api = null ;
2123 private static IPublicAPI API => api ??= Ioc . Default . GetRequiredService < IPublicAPI > ( ) ;
2224
23- private static readonly string ClassName = nameof ( CommunityPluginSource ) ;
24-
2525 private string latestEtag = "" ;
2626
2727 private List < UserPlugin > plugins = new ( ) ;
@@ -70,7 +70,7 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token)
7070 else
7171 {
7272 API . LogWarn ( ClassName , $ "Failed to load resource { ManifestFileUrl } with response { response . StatusCode } ") ;
73- return plugins ;
73+ return null ;
7474 }
7575 }
7676 catch ( Exception e )
@@ -83,7 +83,7 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token)
8383 {
8484 API . LogException ( ClassName , "Error Occurred" , e ) ;
8585 }
86- return plugins ;
86+ return null ;
8787 }
8888 }
8989 }
Original file line number Diff line number Diff line change @@ -40,10 +40,14 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token, bool onl
4040 var completedTask = await Task . WhenAny ( tasks ) ;
4141 if ( completedTask . IsCompletedSuccessfully )
4242 {
43- // one of the requests completed successfully; keep its results
44- // and cancel the remaining http requests.
45- pluginResults = await completedTask ;
46- cts . Cancel ( ) ;
43+ var result = await completedTask ;
44+ if ( result != null )
45+ {
46+ // one of the requests completed successfully; keep its results
47+ // and cancel the remaining http requests.
48+ pluginResults = result ;
49+ cts . Cancel ( ) ;
50+ }
4751 }
4852 tasks . Remove ( completedTask ) ;
4953 }
You can’t perform that action at this time.
0 commit comments