mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
bugfix: moved validation inside lock
This commit is contained in:
parent
0bf9fdea84
commit
1d7603bb8c
1 changed files with 15 additions and 14 deletions
|
|
@ -200,6 +200,8 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, IDisposable, ISer
|
||||||
/// Remove the given collection if it exists and is neither the empty nor the default-named collection.
|
/// Remove the given collection if it exists and is neither the empty nor the default-named collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool RemoveCollection(ModCollection collection)
|
public bool RemoveCollection(ModCollection collection)
|
||||||
|
{
|
||||||
|
lock (_collectionsLock)
|
||||||
{
|
{
|
||||||
if (collection.Identity.Index <= ModCollection.Empty.Identity.Index || collection.Identity.Index >= Count)
|
if (collection.Identity.Index <= ModCollection.Empty.Identity.Index || collection.Identity.Index >= Count)
|
||||||
{
|
{
|
||||||
|
|
@ -215,8 +217,7 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, IDisposable, ISer
|
||||||
|
|
||||||
Delete(collection);
|
Delete(collection);
|
||||||
_saveService.ImmediateDelete(new ModCollectionSave(_modStorage, collection));
|
_saveService.ImmediateDelete(new ModCollectionSave(_modStorage, collection));
|
||||||
lock (_collectionsLock)
|
|
||||||
{
|
|
||||||
_collections.RemoveAt(collection.Identity.Index);
|
_collections.RemoveAt(collection.Identity.Index);
|
||||||
// Update indices.
|
// Update indices.
|
||||||
for (var i = collection.Identity.Index; i < _collections.Count; ++i)
|
for (var i = collection.Identity.Index; i < _collections.Count; ++i)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue