Improve handling of null models when importing

This commit is contained in:
HoLLy 2019-06-19 19:29:47 +02:00
parent 15c75b4442
commit ef2e93d5c7

View File

@ -160,7 +160,8 @@ namespace osu.Game.Database
lock (imported)
{
imported.Add(model);
if (model != null)
imported.Add(model);
current++;
notification.Text = $"Imported {current} of {paths.Length} {HumanisedModelName}s";
@ -243,7 +244,7 @@ namespace osu.Game.Database
/// </summary>
/// <param name="archive">The archive to be imported.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
public Task<TModel> Import(ArchiveReader archive, CancellationToken cancellationToken = default)
public async Task<TModel> Import(ArchiveReader archive, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
@ -267,7 +268,7 @@ namespace osu.Game.Database
return null;
}
return Import(model, archive, cancellationToken);
return await Import(model, archive, cancellationToken);
}
/// <summary>