From ad8a710a690b3ee2888c145b171f9000bd21df3a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Nov 2021 15:26:28 +0900 Subject: [PATCH] Fix failed imports being incorrectly considered as successfully importing for notification purposes --- osu.Game/Database/ArchiveModelManager.cs | 2 +- osu.Game/Database/IModelImporter.cs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 320f108886..e8b6996869 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -264,7 +264,7 @@ namespace osu.Game.Database model = CreateModel(archive); if (model == null) - return Task.FromResult>(new EntityFrameworkLive(null)); + return Task.FromResult>(null); } catch (TaskCanceledException) { diff --git a/osu.Game/Database/IModelImporter.cs b/osu.Game/Database/IModelImporter.cs index 5d0a044578..d00cfb2035 100644 --- a/osu.Game/Database/IModelImporter.cs +++ b/osu.Game/Database/IModelImporter.cs @@ -7,6 +7,8 @@ using System.Threading.Tasks; using osu.Game.IO.Archives; using osu.Game.Overlays.Notifications; +#nullable enable + namespace osu.Game.Database { /// @@ -26,7 +28,7 @@ namespace osu.Game.Database /// Whether this is a low priority import. /// An optional cancellation token. /// The imported model, if successful. - Task> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default); + Task?> Import(ImportTask task, bool lowPriority = false, CancellationToken cancellationToken = default); /// /// Silently import an item from an . @@ -34,7 +36,7 @@ namespace osu.Game.Database /// The archive to be imported. /// Whether this is a low priority import. /// An optional cancellation token. - Task> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default); + Task?> Import(ArchiveReader archive, bool lowPriority = false, CancellationToken cancellationToken = default); /// /// Silently import an item from a . @@ -43,7 +45,7 @@ namespace osu.Game.Database /// An optional archive to use for model population. /// Whether this is a low priority import. /// An optional cancellation token. - Task> Import(TModel item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default); + Task?> Import(TModel item, ArchiveReader? archive = null, bool lowPriority = false, CancellationToken cancellationToken = default); /// /// A user displayable name for the model type associated with this manager.