Skip to content

Commit

Permalink
Prevent fetching data for non-existing parts.
Browse files Browse the repository at this point in the history
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I107c39d35a33b9e5e95589964904a7c8f4690411
  • Loading branch information
gokaysatir committed Nov 20, 2024
1 parent eace126 commit a151899
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions browser/src/layer/tile/CanvasTileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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*/);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a151899

Please sign in to comment.