Skip to content

Commit 24bd866

Browse files
Fixed a null ref exception in static sky when the default volume profile is invalid. (#278)
* Fixed a null ref exception in static sky when the default volume profile is invalid. * Update changelog Co-authored-by: sebastienlagarde <[email protected]>
1 parent aa625cc commit 24bd866

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
567567
- Fixed an error about procedural sky being logged by mistake.
568568
- Fixed shadowmask UI now correctly showing shadowmask disable
569569
- Made more explicit the warning about raytracing and asynchronous compute. Also fixed the condition in which it appears.
570+
- Fixed a null ref exception in static sky when the default volume profile is invalid.
570571

571572
### Changed
572573
- Improve MIP selection for decals on Transparents

com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ void UpdateCurrentStaticLightingSky()
132132
var profileSkyParameters = m_SkySettingsFromProfile.parameters;
133133

134134
var defaultVolume = HDRenderPipeline.GetOrCreateDefaultVolume();
135-
defaultVolume.sharedProfile.TryGet(skyType, out SkySettings defaultSky);
135+
SkySettings defaultSky = null;
136+
if (defaultVolume.sharedProfile != null) // This can happen with old projects.
137+
defaultVolume.sharedProfile.TryGet(skyType, out defaultSky);
136138
var defaultSkyParameters = defaultSky != null ? defaultSky.parameters : null; // Can be null if the profile does not contain the component.
137139

138140
// Seems to inexplicably happen sometimes on domain reload.

0 commit comments

Comments
 (0)