From 871536162cf1e67ea540ec58d2852bb5ded9e1ed Mon Sep 17 00:00:00 2001 From: nirvn Date: Wed, 26 Jun 2019 18:22:03 +0700 Subject: [PATCH] [arcgisrest] Fix crash when fetching an image errors out --- src/providers/arcgisrest/qgsamsprovider.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/providers/arcgisrest/qgsamsprovider.cpp b/src/providers/arcgisrest/qgsamsprovider.cpp index 90888fe813c..e7f3cf7b24f 100644 --- a/src/providers/arcgisrest/qgsamsprovider.cpp +++ b/src/providers/arcgisrest/qgsamsprovider.cpp @@ -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;