Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nullpointer check #8766

Merged
merged 2 commits into from
May 4, 2020
Merged

Conversation

jbo023
Copy link
Contributor

@jbo023 jbo023 commented Apr 17, 2020

add a nullpointer check for updateClamping function.

This fixes a bug where a removed billboard can prevent changing of the terrainProvider.
This only occurs if the billboardcollection is a child of a primitiveCollection, which is set to show=false, so the billboard never gets cleaned up.

The following Sandcastle Code can produce the problem

var viewer = new Cesium.Viewer('cesiumContainer', {
    terrainProvider: Cesium.createWorldTerrain()
});

var scene = viewer.scene;

var primitiveCollection = new Cesium.PrimitiveCollection();
var billboards = primitiveCollection.add(new Cesium.BillboardCollection({scene: scene}));
scene.primitives.add(primitiveCollection);
var billboard = billboards.add({
    position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883, 150000),
    image : '../images/Cesium_Logo_overlay.png',
    heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
});

Sandcastle.addToolbarButton( 'crash',function() {
    billboards.remove(billboard);
    primitiveCollection.show = false;                
    viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider({});
});

@cesium-concierge
Copy link

Thanks for the pull request @jbo023!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@hpinkos
Copy link
Contributor

hpinkos commented May 1, 2020

Thanks for the PR @jbo023! I just had that one comment, then I'll get this merged for the June release.

@jbo023
Copy link
Contributor Author

jbo023 commented May 2, 2020

@hpinkos thanks for reviewing, i changed the code to use defined and rebased to the current master

@hpinkos
Copy link
Contributor

hpinkos commented May 4, 2020

Great, thanks @jbo023!

@hpinkos hpinkos merged commit e5ea83c into CesiumGS:master May 4, 2020
@hpinkos
Copy link
Contributor

hpinkos commented May 4, 2020

Upated CHANGES.md here: 74e286c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants