A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
Fixed a bug when cancelling browser selection (#379)
Etienne Baudoux0bb688a630a4
diff --git a/src/dev/impl/DevToys/UI/Controls/FileSelector.xaml.cs b/src/dev/impl/DevToys/UI/Controls/FileSelector.xaml.csindex e8e98a85f..22f918fc6 100644--- a/src/dev/impl/DevToys/UI/Controls/FileSelector.xaml.cs+++ b/src/dev/impl/DevToys/UI/Controls/FileSelector.xaml.cs@@ -247,13 +247,16 @@ namespace DevToys.UI.ControlsfolderPicker.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);+ }}}