diff --git a/modules/OpenSimConcurrentFlotsamAssetCache/addon-modules/OpenSimConcurrentFlotsamAssetCache/Modules/ConcurrentFlotsamAssetCache.cs b/modules/OpenSimConcurrentFlotsamAssetCache/addon-modules/OpenSimConcurrentFlotsamAssetCache/Modules/ConcurrentFlotsamAssetCache.cs index 01b6fdb..d5010a4 100644 --- a/modules/OpenSimConcurrentFlotsamAssetCache/addon-modules/OpenSimConcurrentFlotsamAssetCache/Modules/ConcurrentFlotsamAssetCache.cs +++ b/modules/OpenSimConcurrentFlotsamAssetCache/addon-modules/OpenSimConcurrentFlotsamAssetCache/Modules/ConcurrentFlotsamAssetCache.cs @@ -547,9 +547,13 @@ namespace OpenSim.Region.CoreModules.Asset { weakAssetReferences.AddOrUpdate( key, - static _ => new WeakReference(asset), - static (_, existing) => + _ => new WeakReference(asset), + (_, existing) => { + // defensive: handle rare case where existing could be null + if (existing is null) + return new WeakReference(asset); + existing.SetTarget(asset); return existing; });