From 7a7bf3ce0584cddbd4763e919a5302a11c78830f Mon Sep 17 00:00:00 2001 From: David Manthey Date: Mon, 27 Jun 2022 08:30:43 -0400 Subject: [PATCH] fix: Guard accessing a quad feature. --- src/canvas/tileLayer.js | 4 +++- src/webgl/pixelmapFeature.js | 4 +++- src/webgl/tileLayer.js | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/canvas/tileLayer.js b/src/canvas/tileLayer.js index 634d41ad79..816ec3e4ce 100644 --- a/src/canvas/tileLayer.js +++ b/src/canvas/tileLayer.js @@ -69,7 +69,9 @@ var canvas_tileLayer = function () { */ this._update = function (request) { s_update.call(m_this, request); - m_quadFeature.nearestPixel(m_this.nearestPixel()); + if (m_quadFeature && m_quadFeature.nearestPixel) { + m_quadFeature.nearestPixel(m_this.nearestPixel()); + } m_this._addBaseQuadToTiles(m_quadFeature, m_tiles); return m_this; }; diff --git a/src/webgl/pixelmapFeature.js b/src/webgl/pixelmapFeature.js index 786973dbb7..aff1d3d541 100644 --- a/src/webgl/pixelmapFeature.js +++ b/src/webgl/pixelmapFeature.js @@ -184,7 +184,9 @@ var webgl_pixelmapFeature = function (arg) { if (arg.quadFeature) { m_quadFeature = arg.quadFeature; - m_quadFeature.nearestPixel(true); + if (m_quadFeature.nearestPixel) { + m_quadFeature.nearestPixel(true); + } } this._init(arg); return this; diff --git a/src/webgl/tileLayer.js b/src/webgl/tileLayer.js index e0d17fb92c..b27cece10e 100644 --- a/src/webgl/tileLayer.js +++ b/src/webgl/tileLayer.js @@ -171,7 +171,9 @@ var webgl_tileLayer = function () { */ this._update = function (request) { s_update.call(m_this, request); - m_quadFeature.nearestPixel(m_this.nearestPixel()); + if (m_quadFeature && m_quadFeature.nearestPixel) { + m_quadFeature.nearestPixel(m_this.nearestPixel()); + } m_this._addBaseQuadToTiles(m_quadFeature, m_tiles); return m_this; };