From 39835006016dad99d59defbcdd447444b6378a76 Mon Sep 17 00:00:00 2001 From: Tapio Koskinen Date: Mon, 19 Oct 2020 13:57:30 +0300 Subject: [PATCH] Don't try to get image data for zero sized images Otherwise "context.getImageData(0, 0, width, height)" throws an exception. --- src/ol/source/Raster.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ol/source/Raster.js b/src/ol/source/Raster.js index 9ca0d9e7ba..8f6ea35d7f 100644 --- a/src/ol/source/Raster.js +++ b/src/ol/source/Raster.js @@ -832,6 +832,9 @@ function getImageData(layer, frameState) { } const width = frameState.size[0]; const height = frameState.size[1]; + if (width === 0 || height === 0) { + return null; + } const container = renderer.renderFrame(frameState, null); let element; if (container) {