浏览代码

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

Fixed sequence not found exception
Krzysztof Krysiński 3 周之前
父节点
当前提交
974ee2fee5
共有 1 个文件被更改,包括 6 次插入0 次删除
  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));
     }