Skip to content

Commit

Permalink
Fix possible divide by 0
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 5, 2016
1 parent f70be07 commit f279183
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/providers/arcgisrest/qgsamsprovider.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit f279183

Please sign in to comment.