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();
}