[arcgisrest] Fix crash when fetching an image errors out

This commit is contained in:
nirvn 2019-06-26 18:22:03 +07:00 committed by Nyall Dawson
parent 718f21e807
commit 871536162c

View File

@ -728,6 +728,7 @@ QImage QgsAmsProvider::draw( const QgsRectangle &viewExtent, int pixelWidth, int
QByteArray reply = QgsArcGisRestUtils::queryService( requestUrl, authcfg, mErrorTitle, mError, mRequestHeaders, feedback, &contentType );
if ( !mError.isEmpty() )
{
p.end();
mCachedImage = QImage();
if ( feedback )
feedback->appendError( QStringLiteral( "%1: %2" ).arg( mErrorTitle, mError ) );
@ -736,6 +737,7 @@ QImage QgsAmsProvider::draw( const QgsRectangle &viewExtent, int pixelWidth, int
else if ( contentType.startsWith( QLatin1String( "application/json" ) ) )
{
// if we get a JSON response, something went wrong (e.g. authentication error)
p.end();
mCachedImage = QImage();
QJsonParseError err;