openlayers / ol-cesium

OpenLayers - Cesium integration
http://openlayers.org/ol-cesium/
BSD 2-Clause "Simplified" License
970 stars 322 forks source link

`this.parent_` is undefined in `SynchronizedOverlay#handlePositionChanged` #1159

Closed simonseyock closed 5 months ago

simonseyock commented 5 months ago

I get errors in SynchronizedOverlay#handlePositionChanged complaining that this.parent_ is undefined.

https://github.com/openlayers/ol-cesium/blob/fe53e35dba84c7712673e118511b3fa10020a24c/src/olcs/SynchronizedOverlay.ts#L178-L188

This call of handlePositionChanged is caused by this line in openlayers:

https://github.com/openlayers/openlayers/blob/73f4636c85e569c6aca36f2ad478b677b7929872/src/ol/Overlay.js#L208

At this point the constructor of Overlay has not completed yet so this.parent_ is not set yet.

The easiest way to get around this would be to just check if this.parent_ is not undefined. I will open an PR for that.

@gberaudo If you decide to merge this, it would be really great if you could do a npm release as I cannot fix that issues with a hotfix on our side.