Skip to content

Commit

Permalink
Check if the value is null. Fixes #37781
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Sep 28, 2020
1 parent 8d2a0d1 commit 86175e3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -1774,7 +1774,14 @@ namespace QgsWms
{
QDomElement attributeElement = infoDocument.createElement( QStringLiteral( "Attribute" ) );
attributeElement.setAttribute( QStringLiteral( "name" ), layer->bandName( it.key() ) );
attributeElement.setAttribute( QStringLiteral( "value" ), QString::number( it.value().toDouble() ) );

QString value( QStringLiteral( "no data" ) );
if ( ! it.value().isNull() )
{
value = QString::number( it.value().toDouble() );
}

attributeElement.setAttribute( QStringLiteral( "value" ), value );
layerElement.appendChild( attributeElement );
}
}
Expand Down

0 comments on commit 86175e3

Please sign in to comment.