1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 20:58:34 +01:00

make sure disposable assets are only marked once

This commit is contained in:
Ellpeck 2020-04-22 13:52:25 +02:00
parent 3f89b47eef
commit d419b1095e

View file

@ -54,7 +54,7 @@ namespace MLEM.Content {
if (!(read is T t))
throw new ContentLoadException($"{reader} returned non-{typeof(T)} for asset {assetName}");
this.LoadedAssets[assetName] = t;
if (t is IDisposable d)
if (t is IDisposable d && !this.disposableAssets.Contains(d))
this.disposableAssets.Add(d);
return t;
}