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));