1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 02:43:19 +08:00

Fix importing collections twice from stable causing a hard crash

Somehow a bindable equality check failure got through review. Not sure
if there's some way to protect against this going forward, but we may
want to.
This commit is contained in:
Dean Herbert 2021-02-23 15:57:41 +09:00
parent 66f86bdee5
commit c514233141

View File

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