Bug in scene.globe.getHeight ?

1. A concise explanation of the problem you're experiencing.

If I call "scene.globe.getHeight" immediately after calling "scene.camera.flyTo", a drawing error occurs.

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

Code exsample:
https://jsfiddle.net/aminon/7kLg63bt/7/

An error occurs when you repeatedly left click on the view quickly and repeatedly.
  
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

When switching a list of locations, I want to switch the viewpoint to that location.
The user may manipulate this quickly and repeatedly.

4. The Cesium version you're using, your operating system and browser.

Cesium 1.55
Chrome 73
Windows 10

No errors occurred in cesium 1.54 and 1.55(Unminified).

Error log is here:
An error occurred while rendering. Rendering has stopped.
  RangeError: Invalid array length
  RangeError: Invalid array length
    at w (https://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js:521:30793)
    at T.createPotentiallyVisibleSet (https://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js:522:1946)
    at rt (https://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js:522:25469)
    at et (https://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js:522:22852)
    at pt (https://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js:523:495)
    at ft (https://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js:523:682)
    at Ie.render (https://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js:523:12921)
    at x.render (https://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js:529:26396)
    at t (https://cesiumjs.org/releases/1.55/Build/Cesium/Cesium.js:529:19846)

Thanks for the code example!

The problem is that getHeight does not always return a number:

https://cesiumjs.org/Cesium/Build/Documentation/Globe.html?classFilter=Globe#getHeight

It will either be the height, or undefined. The first click should always work. After that, when the globe is zoomed in, and you call getHeight on a location that is no longer loaded, that’s when it returns undefined.

To get the height of an area even if it’s not loaded, you can use sampleTerrain:

https://cesiumjs.org/Cesium/Build/Documentation/sampleTerrain.html?classFilter=sampleTer

If you have terrain loaded in, you can also use sampleTerrainMostDetailed:

https://cesiumjs.org/Cesium/Build/Documentation/sampleTerrainMostDetailed.html?classFilter=sampleTerr

Here’s an updated fiddle:

https://jsfiddle.net/7canj1wr/

Now it should work on each click. It will throw an error when the longitude passes 180 though.

Thanks for your help! I'll try it.