Skip to content

Commit 1a758c3

Browse files
committed
Use Token.throwifCancellationRequested
1 parent 5389763 commit 1a758c3

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ private List<Result> DirectorySearch(EnumerationOptions enumerationOption, Query
7676
fileList.Add(resultManager.CreateFileResult(fileSystemInfo.FullName, query, true, false));
7777
}
7878

79-
if (token.IsCancellationRequested)
80-
return null;
79+
token.ThrowIfCancellationRequested();
8180
}
8281
}
8382
catch (Exception e)

Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ internal async Task<List<Result>> SearchAsync(Query query, CancellationToken tok
7777

7878
results.Add(resultManager.CreateOpenCurrentFolderResult(locationPath, useIndexSearch));
7979

80-
if (token.IsCancellationRequested)
81-
return null;
80+
token.ThrowIfCancellationRequested();
8281

8382
var directoryResult = await TopLevelDirectorySearchBehaviourAsync(WindowsIndexTopLevelFolderSearchAsync,
8483
DirectoryInfoClassSearch,
@@ -87,11 +86,10 @@ internal async Task<List<Result>> SearchAsync(Query query, CancellationToken tok
8786
locationPath,
8887
token).ConfigureAwait(false);
8988

90-
if (token.IsCancellationRequested)
91-
return null;
89+
token.ThrowIfCancellationRequested();
9290

9391
results.AddRange(directoryResult);
94-
92+
9593
return results;
9694
}
9795

0 commit comments

Comments
 (0)