1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 14:22:55 +08:00

Update ArchiveModelManager.cs

This commit is contained in:
Paul Teng 2018-09-20 20:01:04 -04:00 committed by GitHub
parent 7efaaceba5
commit 52877eca83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -286,9 +286,10 @@ namespace osu.Game.Database
using (ContextFactory.GetForWrite()) using (ContextFactory.GetForWrite())
{ {
// re-fetch the model on the import context. // re-fetch the model on the import context.
var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).First(s => s.ID == item.ID); var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID);
if (foundModel.DeletePending) return; // Test for null since FirstOrDefault will return null if nothing is found
if (foundModel == null || foundModel.DeletePending) return;
if (ModelStore.Delete(foundModel)) if (ModelStore.Delete(foundModel))
Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray()); Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray());