Skip to content

Commit

Permalink
fix legend when no layers required
Browse files Browse the repository at this point in the history
  • Loading branch information
speillet committed Jun 29, 2021
1 parent 14b20ec commit e097ed6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -803,7 +803,16 @@ namespace QgsWms
// get model and layer tree root of the legend
QgsLegendModel *model = legend->model();
QStringList layerSet;
const QList<QgsMapLayer *> layerList( map->layers() );
QList<QgsMapLayer *> mapLayers;
if ( map->layers().isEmpty() )
{
mapLayers = mProject->mapLayers( true ).values();
}
else
{
mapLayers = map->layers();
}
const QList<QgsMapLayer *> layerList = mapLayers;
for ( const auto &layer : layerList )
layerSet << layer->id();

Expand Down

0 comments on commit e097ed6

Please sign in to comment.