Check if the value is null. Fixes #37781

This commit is contained in:
Blottiere Paul 2020-09-16 14:30:50 +02:00
parent 8d2a0d1ebb
commit 86175e305f

View File

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