Fix duplicated exception when the item was deleted

This commit is contained in:
Zoe Roux 2024-01-30 23:29:05 +01:00
parent a01ce5c11c
commit f0e6ee5835
2 changed files with 3 additions and 4 deletions

View File

@ -19,8 +19,6 @@
using System.Threading.Tasks;
using Kyoo.Abstractions.Models;
#nullable enable
namespace Kyoo.Abstractions.Controllers
{
/// <summary>

View File

@ -140,7 +140,7 @@ namespace Kyoo.Core.Controllers
{
lock (_downloading)
{
if (File.Exists(posterPath) || _downloading.ContainsKey(posterPath))
if (_downloading.ContainsKey(posterPath))
{
duplicated = true;
sync = _downloading.GetValueOrDefault(posterPath);
@ -154,7 +154,8 @@ namespace Kyoo.Core.Controllers
if (duplicated)
{
object? dup = sync != null ? await sync.Task : null;
throw new DuplicatedItemException(dup);
if (dup != null)
throw new DuplicatedItemException(dup);
}
await _DownloadImage(