From 394d96246bf8a70c87f2fbcc2920edca9b5748e9 Mon Sep 17 00:00:00 2001 From: DrPandemic Date: Sun, 23 Jun 2019 10:13:50 -0400 Subject: [PATCH] Check path before opening image --- CONTRIBUTORS.md | 3 ++- Jellyfin.Drawing.Skia/SkiaEncoder.cs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index c3fcea1e21..29456598f1 100644 --- a/CONTRIBUTORS.md +++ b/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 diff --git a/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/Jellyfin.Drawing.Skia/SkiaEncoder.cs index 5060476bad..1eda817a39 100644 --- a/Jellyfin.Drawing.Skia/SkiaEncoder.cs +++ b/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)) {