Skip to content

Commit

Permalink
Fixed a bug when cancelling browser selection (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
veler committed Feb 13, 2022
1 parent b321b01 commit aa8624a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/dev/impl/DevToys/UI/Controls/FileSelector.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,16 @@ private async void BrowseFoldersHyperlinkButton_Click(object sender, RoutedEvent

folderPicker.FileTypeFilter.Add("*");

StorageFolder folder = await folderPicker.PickSingleFolderAsync();
StorageFolder? folder = await folderPicker.PickSingleFolderAsync();

foreach (StorageFile file in await folder.GetFilesAsync())
if (folder is not null)
{
if (_allowedFileExtensions.Any(ext => string.Equals(ext, "*", StringComparison.Ordinal) || string.Equals(ext, file.FileType, StringComparison.OrdinalIgnoreCase)))
foreach (StorageFile file in await folder.GetFilesAsync())
{
files.Add(file);
if (_allowedFileExtensions.Any(ext => string.Equals(ext, "*", StringComparison.Ordinal) || string.Equals(ext, file.FileType, StringComparison.OrdinalIgnoreCase)))
{
files.Add(file);
}
}
}

Expand Down

0 comments on commit aa8624a

Please sign in to comment.