Browse Source

Merge pull request #1212 from PixiEditor/fix/file-extension-crash

Fixed sequence not found exception
Krzysztof Krysiński 3 tuần trước cách đây
mục cha
commit
974ee2fee5
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      src/PixiEditor/Helpers/SupportedFilesHelper.cs

+ 6 - 0
src/PixiEditor/Helpers/SupportedFilesHelper.cs

@@ -86,6 +86,12 @@ internal class SupportedFilesHelper
         string? localPath = file.TryGetLocalPath();
 
         string extension = Path.GetExtension(localPath ?? file.Name);
+
+        if (string.IsNullOrEmpty(extension))
+        {
+            return allSupportedExtensions.First(i => i.CanSave);
+        }
+
         return allSupportedExtensions.Single(i => i.CanSave && i.Extensions.Contains(extension, StringComparer.OrdinalIgnoreCase));
     }