Merge pull request #11882 from peppy/fix-import-collections-twice-crash

Fix importing collections twice from stable causing a hard crash
This commit is contained in:
Dan Balasescu 2021-02-24 14:31:54 +09:00 committed by GitHub
commit a229c3a0f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -138,10 +138,10 @@ namespace osu.Game.Collections
PostNotification?.Invoke(notification);
var collection = readCollections(stream, notification);
await importCollections(collection);
var collections = readCollections(stream, notification);
await importCollections(collections);
notification.CompletionText = $"Imported {collection.Count} collections";
notification.CompletionText = $"Imported {collections.Count} collections";
notification.State = ProgressNotificationState.Completed;
}
@ -155,7 +155,7 @@ namespace osu.Game.Collections
{
foreach (var newCol in newCollections)
{
var existing = Collections.FirstOrDefault(c => c.Name == newCol.Name);
var existing = Collections.FirstOrDefault(c => c.Name.Value == newCol.Name.Value);
if (existing == null)
Collections.Add(existing = new BeatmapCollection { Name = { Value = newCol.Name.Value } });