diff --git a/Logic/FeatureSource/GeoJsonSource.ts b/Logic/FeatureSource/GeoJsonSource.ts index 40d39b2ce..84a89327e 100644 --- a/Logic/FeatureSource/GeoJsonSource.ts +++ b/Logic/FeatureSource/GeoJsonSource.ts @@ -124,14 +124,18 @@ export default class GeoJsonSource implements FeatureSource { } // Yup, this is cheating to just get the bounds here - const bounds = State.state.leafletMap.data.getBounds() + const bounds = State.state.leafletMap.data?.getBounds() + if(bounds === undefined){ + // We'll retry later + return undefined + } const tileRange = Utils.TileRangeBetween(zoomLevel, bounds.getNorth(), bounds.getEast(), bounds.getSouth(), bounds.getWest()) const needed = Utils.MapRange(tileRange, (x, y) => { return url.replace("{x}", "" + x).replace("{y}", "" + y); }) return new Set(needed); } - , [flayer.isDisplayed]); + , [flayer.isDisplayed, State.state.leafletMap]); neededTiles.stabilized(250).addCallback((needed: Set) => { if (needed === undefined) { return; diff --git a/UI/ExportPDF.ts b/UI/ExportPDF.ts index 7a75ae921..aea7561b0 100644 --- a/UI/ExportPDF.ts +++ b/UI/ExportPDF.ts @@ -105,7 +105,7 @@ export default class ExportPDF { } private cleanup() { - // new FixedUiElement("Screenshot taken!").AttachTo(this.freeDivId) + new FixedUiElement("Screenshot taken!").AttachTo(this.freeDivId) this._screenhotTaken = true; }