VIewer.Destroy crashes

Viewer.destroy() throws an exception.

In the default Sandcastle, the following javascript code demonstrates:

        var viewer = new Cesium.Viewer('cesiumContainer');

        setTimeout(function() { viewer.destroy(); } , 1000);

The exception:

    "Unable to get property 'destroy' of undefined or null reference (on line 2071 of https://cesiumjs.org/Cesium/Source/Scene/Scene.js)"

The busted line of code:

        this._globeDepth.destroy();

Fix that is working for me:

        if (this._globeDepth) {
            this._globeDepth.destroy();
        }

Thanks for reporting this. However, I was not able to reproduce it in master. What browser were you using?

I think this was fixed in master a few weeks ago:

https://github.com/AnalyticalGraphicsInc/cesium/pull/2859

I’m using IE11

Scott is right, this is definitely fixed in master. 1.12 will be released with the fix on August 3rd.

Cool, thanks