Skip to content
Permalink
Browse files

Fix possible divide by 0

  • Loading branch information
nyalldawson committed Jun 5, 2016
1 parent f70be07 commit f2791836e998e951b7bb0436f41365d77f25b8a0
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/providers/arcgisrest/qgsamsprovider.cpp
@@ -100,7 +100,8 @@ void QgsAmsLegendFetcher::handleFinished()
maxImageSize.setWidth( qMax( maxImageSize.width(), legendEntry.second.width() ) );
maxImageSize.setHeight( qMax( maxImageSize.height(), legendEntry.second.height() ) );
}
double scaleFactor = qMin( 1., qMin( double( imageSize ) / maxImageSize.width(), double( imageSize ) / maxImageSize.height() ) );
double scaleFactor = maxImageSize.width() == 0 || maxImageSize.height() == 0 ? 1.0 :
qMin( 1., qMin( double( imageSize ) / maxImageSize.width(), double( imageSize ) / maxImageSize.height() ) );

mLegendImage = QImage( imageSize + padding + textWidth, vpadding + legendEntries.size() * ( imageSize + vpadding ), QImage::Format_ARGB32 );
mLegendImage.fill( Qt::transparent );

0 comments on commit f279183

Please sign in to comment.
You can’t perform that action at this time.