From 0a3e7050ce5f3ecca55aa86ed99cc43ba82fb111 Mon Sep 17 00:00:00 2001 From: rldhont Date: Thu, 15 Feb 2024 16:52:37 +0100 Subject: [PATCH] [Bugfix] WMS GetLegendGraphic for no symbols layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Funded by Conseil Départemental du Calvados --- lizmap/modules/lizmap/lib/Request/WMSRequest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lizmap/modules/lizmap/lib/Request/WMSRequest.php b/lizmap/modules/lizmap/lib/Request/WMSRequest.php index 372d6842db..e956b4561c 100644 --- a/lizmap/modules/lizmap/lib/Request/WMSRequest.php +++ b/lizmap/modules/lizmap/lib/Request/WMSRequest.php @@ -300,6 +300,9 @@ protected function process_getlegendgraphic() if ($result->code == 200) { $layer = $this->project->findLayerByAnyName($lName); $nodes = json_decode($result->data)->nodes; + if (!$nodes) { + return $result; + } // Rework nodes if ($layer->groupAsLayer == 'True' | $layer->type == 'group') { // Create a dedicated node for group @@ -372,7 +375,9 @@ protected function process_getlegendgraphic() return $result; } $nodes = json_decode($result->data)->nodes; - $legends['nodes'][] = $nodes[0]; + if ($nodes) { + $legends['nodes'][] = $nodes[0]; + } } return new OGCResponse(200, 'application/json', json_encode($legends));