Prevent access on null
CesiumPointCloudShading
#605
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This addresses a bug with point cloud tilesets that are created at runtime. Since
CesiumPointCloudShading
is aclass
, not astruct
, it's possible for aCesium3DTileset
to be missing one, which is exactly what happens when it is created at runtime. This PR adds checks for anull
reference, and also explicitly initializesCesiumPointCloudShading
inline for good measure.Ideally,
CesiumPointCloudShading
would just be astruct
to avoid this, but C# 9.0 does not likestructs
with non-zero default values. :)Issue number or link
Fixes #602.
Author checklist
CHANGES.md
with a short summary of my change (for user-facing changes).[ ] I have added or updated unit tests to ensure consistent code coverage as necessary.[] I have updated the documentation as necessary.Testing plan
02_CesiumMelbourne
in the Cesium samples.PointCloudLoader
with the contents below.GameObject
. I just tacked it onto theGetting Started
object.