diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 9523b1bf6e1..d2ab7d1072e 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -567,6 +567,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an error about procedural sky being logged by mistake. - Fixed shadowmask UI now correctly showing shadowmask disable - Made more explicit the warning about raytracing and asynchronous compute. Also fixed the condition in which it appears. +- Fixed a null ref exception in static sky when the default volume profile is invalid. ### Changed - Improve MIP selection for decals on Transparents diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs index d2cb6061cc2..16729facca7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs @@ -132,7 +132,9 @@ void UpdateCurrentStaticLightingSky() var profileSkyParameters = m_SkySettingsFromProfile.parameters; var defaultVolume = HDRenderPipeline.GetOrCreateDefaultVolume(); - defaultVolume.sharedProfile.TryGet(skyType, out SkySettings defaultSky); + SkySettings defaultSky = null; + if (defaultVolume.sharedProfile != null) // This can happen with old projects. + defaultVolume.sharedProfile.TryGet(skyType, out defaultSky); var defaultSkyParameters = defaultSky != null ? defaultSky.parameters : null; // Can be null if the profile does not contain the component. // Seems to inexplicably happen sometimes on domain reload.