bugfix: prevent skipping over 1

Maintainers expect _currentCollectionIdValue to start at 1, and I don't want to change that
This commit is contained in:
mayo 2025-11-01 17:22:45 -04:00
parent 1d7603bb8c
commit cc95678d05
No known key found for this signature in database
GPG key ID: 5B138E78344184A6

View file

@ -90,7 +90,11 @@ public class CollectionStorage : IReadOnlyList<ModCollection>, IDisposable, ISer
public LocalCollectionId CurrentCollectionId => new(_currentCollectionIdValue);
private LocalCollectionId AllocateNextId ()
=> new(Interlocked.Increment(ref _currentCollectionIdValue));
{
var newLocalId = new LocalCollectionId(_currentCollectionIdValue);
Interlocked.Increment(ref _currentCollectionIdValue);
return newLocalId;
}
/// <summary> Default enumeration skips the empty collection. </summary>
public IEnumerator<ModCollection> GetEnumerator()