summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-02-27 15:16:35 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-02-28 12:52:26 +0200
commit2b1bb1dc4a840a139e5f7823fea0641f7a7c91f8 (patch)
tree6203b32f17a2c4a9fec54f464e93246804787687
parente0c2b3e771bdd4a23bb7442240ccc3dbf1c1c57a (diff)
downloadqtlocation-mapboxgl-2b1bb1dc4a840a139e5f7823fea0641f7a7c91f8.tar.gz
[core][offline] Offline download does not hang on 404 error
-rw-r--r--platform/default/src/mbgl/storage/offline_download.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/platform/default/src/mbgl/storage/offline_download.cpp b/platform/default/src/mbgl/storage/offline_download.cpp
index 89fd100aa7..e1413b61b0 100644
--- a/platform/default/src/mbgl/storage/offline_download.cpp
+++ b/platform/default/src/mbgl/storage/offline_download.cpp
@@ -484,6 +484,13 @@ void OfflineDownload::ensureResource(Resource&& resource,
*fileRequestsIt = onlineFileSource.request(resource, [=](Response onlineResponse) {
if (onlineResponse.error) {
observer->responseError(*onlineResponse.error);
+ if (onlineResponse.error->reason == Response::Error::Reason::NotFound) {
+ // On error 404, we skip this request and go further.
+ requests.erase(fileRequestsIt);
+ assert(status.requiredResourceCount > 0);
+ status.requiredResourceCount--;
+ continueDownload();
+ }
return;
}