From 132ce172edef1317854875d2dc81b4dfe5b79d90 Mon Sep 17 00:00:00 2001 From: sweco-dkjesh <4609097+sweco-dkjesh@users.noreply.github.com> Date: Wed, 9 Sep 2020 12:29:43 +0200 Subject: [PATCH] null pointer fix and improved handling of Identifier Fix nullpointer error when a matrixSet is not found in the matrixsetobj when matrix limits exist. Also check for match by prepending matrixSetObj.Identifier which is supported by some wmts services. --- src/ol/source/WMTS.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ol/source/WMTS.js b/src/ol/source/WMTS.js index b61af5eee2..726c03ce8a 100644 --- a/src/ol/source/WMTS.js +++ b/src/ol/source/WMTS.js @@ -465,10 +465,12 @@ export function optionsFromCapabilities(wmtsCap, config) { //in case of matrix limits, use matrix limits to calculate extent if (matrixLimits) { selectedMatrixLimit = matrixLimits[matrixLimits.length - 1]; - matrix = find( + const m = find( matrixSetObj.TileMatrix, - (value) => value.Identifier === selectedMatrixLimit.TileMatrix + (tileMatrixValue) => tileMatrixValue.Identifier === selectedMatrixLimit.TileMatrix || matrixSetObj.Identifier + ":" + tileMatrixValue.Identifier === selectedMatrixLimit.TileMatrix ); + if (m) + matrix = m; } const resolution =