Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Server: do not crash on broken tree
  • Loading branch information
github-actions[bot] authored and nyalldawson committed Dec 1, 2020
1 parent 03ae9fd commit 6c04524
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/server/services/wms/qgswmsgetcapabilities.cpp
Expand Up @@ -2018,7 +2018,14 @@ namespace QgsWms
{
const auto treeLayer { static_cast<const QgsLayerTreeLayer *>( childNode ) };
const auto l { treeLayer->layer() };
return ! wmsRestrictedLayers.contains( l->name() ) && l->flags().testFlag( QgsMapLayer::Identifiable );
if ( l )
{
return ! wmsRestrictedLayers.contains( l->name() ) && l->flags().testFlag( QgsMapLayer::Identifiable );
}
else
{
QgsMessageLog::logMessage( QStringLiteral( "Broken/corrupted layer tree, layer '%1' does not exist: check your project!" ).arg( treeLayer->name() ), QStringLiteral( "Server" ), Qgis::MessageLevel::Warning );
}
}
return false;
}
Expand All @@ -2028,4 +2035,3 @@ namespace QgsWms




0 comments on commit 6c04524

Please sign in to comment.