diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index d25e193a583..859d0a18cd1 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed ShaderGraph Decal material not showing exposed properties. - Fixed wrong coat normal space in shader graph - Fixed issue with faulty shadow transition when view is close to an object under some aspect ratio conditions +- Fixed NullPointerException when baking probes from the lighting window (case 1289680) ### Changed - Removed the material pass probe volumes evaluation mode. diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs index 24c687329b2..a07b3fd9edd 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs @@ -322,7 +322,7 @@ IScriptableBakedReflectionSystemStageNotifier handle // == 5. == // Create new baked state array - var targetSize = m_HDProbeBakedStates.Length + addCount - remCount; + var targetSize = m_HDProbeBakedStates.Length - remCount + toBakeIndicesList.Count; var targetBakedStates = stackalloc HDProbeBakedState[targetSize]; // Copy baked state that are not removed var targetI = 0; @@ -330,12 +330,14 @@ IScriptableBakedReflectionSystemStageNotifier handle { if (CoreUnsafeUtils.IndexOf(remIndices, remCount, i) != -1) continue; + Assert.IsTrue(targetI < targetSize); targetBakedStates[targetI++] = m_HDProbeBakedStates[i]; } // Add new baked states for (int i = 0; i < toBakeIndicesList.Count; ++i) { var state = states[toBakeIndicesList.GetUnchecked(i)]; + Assert.IsTrue(targetI < targetSize); targetBakedStates[targetI++] = new HDProbeBakedState { instanceID = state.instanceID,