From a1518997b7fda3024f3245637ce1a2a590061703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6kay=20=C5=9Eat=C4=B1r?= Date: Tue, 19 Nov 2024 16:09:38 +0300 Subject: [PATCH] Prevent fetching data for non-existing parts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gökay Şatır Change-Id: I107c39d35a33b9e5e95589964904a7c8f4690411 --- browser/src/layer/tile/CanvasTileLayer.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/browser/src/layer/tile/CanvasTileLayer.js b/browser/src/layer/tile/CanvasTileLayer.js index 0cd75f40ebdf..77395633345f 100644 --- a/browser/src/layer/tile/CanvasTileLayer.js +++ b/browser/src/layer/tile/CanvasTileLayer.js @@ -1072,13 +1072,18 @@ L.CanvasTileLayer = L.Layer.extend({ }, _initPreFetchPartTiles: function() { + const targetPart = this._selectedPart + this._map._partsDirection; + + if (targetPart < 0 || targetPart >= this._parts) + return; + // check existing timeout and clear it before the new one if (this._partTilePreFetcher) clearTimeout(this._partTilePreFetcher); this._partTilePreFetcher = setTimeout( L.bind(function() { - this._preFetchPartTiles(this._selectedPart + this._map._partsDirection, this._selectedMode); + this._preFetchPartTiles(targetPart, this._selectedMode); }, this), 100 /*ms*/); @@ -5779,7 +5784,7 @@ L.CanvasTileLayer = L.Layer.extend({ window.app.console.warn('Tile deleted during rawDelta decompression.'); continue; } - + var keyframeImage = null; if (x.isKeyframe) keyframeImage = new ImageData(x.keyframeBuffer, e.data.tileSize, e.data.tileSize);