diff --git a/src/Avalonia.Base/Platform/Storage/FileIO/StorageProviderHelpers.cs b/src/Avalonia.Base/Platform/Storage/FileIO/StorageProviderHelpers.cs index 55aac6f3fa..76323eb900 100644 --- a/src/Avalonia.Base/Platform/Storage/FileIO/StorageProviderHelpers.cs +++ b/src/Avalonia.Base/Platform/Storage/FileIO/StorageProviderHelpers.cs @@ -10,16 +10,19 @@ internal static class StorageProviderHelpers { public static IStorageItem? TryCreateBclStorageItem(string path) { - var directory = new DirectoryInfo(path); - if (directory.Exists) + if (!string.IsNullOrWhiteSpace(path)) { - return new BclStorageFolder(directory); - } - - var file = new FileInfo(path); - if (file.Exists) - { - return new BclStorageFile(file); + var directory = new DirectoryInfo(path); + if (directory.Exists) + { + return new BclStorageFolder(directory); + } + + var file = new FileInfo(path); + if (file.Exists) + { + return new BclStorageFile(file); + } } return null;