diff --git a/com.unity.render-pipelines.core/CHANGELOG.md b/com.unity.render-pipelines.core/CHANGELOG.md index 839d2922a75..0e9f0bbd6e9 100644 --- a/com.unity.render-pipelines.core/CHANGELOG.md +++ b/com.unity.render-pipelines.core/CHANGELOG.md @@ -53,6 +53,7 @@ The version number for this package has increased due to a version update of a r - Fix hierarchicalbox gizmo outside facing check in symetry or homothety mode no longer move the center - Fix artifacts on Adreno 630 GPUs when using ACES Tonemapping - Fixed a null ref in the volume component list when there is no volume components in the project. +- Fixed issue with volume manager trying to access a null volume. ### Changed - Restored usage of ENABLE_VR to fix compilation errors on some platforms. diff --git a/com.unity.render-pipelines.core/Runtime/Volume/VolumeManager.cs b/com.unity.render-pipelines.core/Runtime/Volume/VolumeManager.cs index 2f8d2e483d2..d0dd19d3cc9 100644 --- a/com.unity.render-pipelines.core/Runtime/Volume/VolumeManager.cs +++ b/com.unity.render-pipelines.core/Runtime/Volume/VolumeManager.cs @@ -124,7 +124,8 @@ public void Register(Volume volume, int layer) // Look for existing cached layer masks and add it there if needed foreach (var kvp in m_SortedVolumes) { - if ((kvp.Key & (1 << layer)) != 0) + // We add the volume to sorted lists only if the layer match and if it doesn't contain the volume already. + if ((kvp.Key & (1 << layer)) != 0 && !kvp.Value.Contains(volume)) kvp.Value.Add(volume); }