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
16
16
{
17
17
public record CommunityPluginSource ( string ManifestFileUrl )
18
18
{
19
+ private static readonly string ClassName = nameof ( CommunityPluginSource ) ;
20
+
19
21
// We should not initialize API in static constructor because it will create another API instance
20
22
private static IPublicAPI api = null ;
21
23
private static IPublicAPI API => api ??= Ioc . Default . GetRequiredService < IPublicAPI > ( ) ;
22
24
23
- private static readonly string ClassName = nameof ( CommunityPluginSource ) ;
24
-
25
25
private string latestEtag = "" ;
26
26
27
27
private List < UserPlugin > plugins = new ( ) ;
@@ -70,7 +70,7 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token)
70
70
else
71
71
{
72
72
API . LogWarn ( ClassName , $ "Failed to load resource { ManifestFileUrl } with response { response . StatusCode } ") ;
73
- return plugins ;
73
+ return null ;
74
74
}
75
75
}
76
76
catch ( Exception e )
@@ -83,7 +83,7 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token)
83
83
{
84
84
API . LogException ( ClassName , "Error Occurred" , e ) ;
85
85
}
86
- return plugins ;
86
+ return null ;
87
87
}
88
88
}
89
89
}
Original file line number Diff line number Diff line change @@ -40,10 +40,14 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token, bool onl
40
40
var completedTask = await Task . WhenAny ( tasks ) ;
41
41
if ( completedTask . IsCompletedSuccessfully )
42
42
{
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
+ }
47
51
}
48
52
tasks . Remove ( completedTask ) ;
49
53
}
You can’t perform that action at this time.
0 commit comments