From 65c47c79da8c970da7adedc61739ac1d87f8dc62 Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Tue, 19 Apr 2022 20:03:19 -0600 Subject: [PATCH] Only delete cache file if exist --- .../LiveTv/Listings/XmlTvListingsProvider.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs index f70e5b089b..bd1cd1e1de 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs @@ -79,7 +79,12 @@ namespace Emby.Server.Implementations.LiveTv.Listings return UnzipIfNeeded(info.Path, cacheFile); } - File.Delete(cacheFile); + // Must check if file exists as parent directory may not exist. + if (File.Exists(cacheFile)) + { + File.Delete(cacheFile); + } + _logger.LogInformation("Downloading xmltv listings from {Path}", info.Path); Directory.CreateDirectory(Path.GetDirectoryName(cacheFile));