瀏覽代碼

Check path before opening image

DrPandemic 6 年之前
父節點
當前提交
394d96246b
共有 2 個文件被更改,包括 7 次插入1 次删除
  1. 2 1
      CONTRIBUTORS.md
  2. 5 0
      Jellyfin.Drawing.Skia/SkiaEncoder.cs

+ 2 - 1
CONTRIBUTORS.md

@@ -23,8 +23,9 @@
  - [fruhnow](https://github.com/fruhnow)
  - [Lynxy](https://github.com/Lynxy)
  - [fasheng](https://github.com/fasheng)
- - [ploughpuff](https://github.com/ploughpuff) 
+ - [ploughpuff](https://github.com/ploughpuff)
  - [pjeanjean](https://github.com/pjeanjean)
+ - [DrPandemic](https://github.com/drpandemic)
 
 # Emby Contributors
 

+ 5 - 0
Jellyfin.Drawing.Skia/SkiaEncoder.cs

@@ -185,6 +185,11 @@ namespace Jellyfin.Drawing.Skia
 
         public ImageDimensions GetImageSize(string path)
         {
+            if (!File.Exists(path))
+            {
+                throw new FileNotFoundException("File not found", path);
+            }
+
             using (var s = new SKFileStream(path))
             using (var codec = SKCodec.Create(s))
             {