summaryrefslogtreecommitdiff
path: root/src/mbgl/sprite
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-02-05 16:52:07 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-02-10 15:40:20 -0800
commite9302c797f68c7e48b908b87b126045c8c5e5209 (patch)
tree044441cdb82ed8752401c43ead9e84018b067fbd /src/mbgl/sprite
parent7eb1a91c4e5134ecfbfb91b61a6622be40478af5 (diff)
downloadqtlocation-mapboxgl-e9302c797f68c7e48b908b87b126045c8c5e5209.tar.gz
[all] Don't interpret 404s on non-tile resources as "no content"
Diffstat (limited to 'src/mbgl/sprite')
-rw-r--r--src/mbgl/sprite/sprite_store.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/mbgl/sprite/sprite_store.cpp b/src/mbgl/sprite/sprite_store.cpp
index 15a345cc4d..38aa7009ca 100644
--- a/src/mbgl/sprite/sprite_store.cpp
+++ b/src/mbgl/sprite/sprite_store.cpp
@@ -38,15 +38,12 @@ void SpriteStore::setURL(const std::string& url) {
loader->jsonRequest = fs->request(Resource::spriteJSON(url, pixelRatio), [this](Response res) {
if (res.error) {
observer->onSpriteError(std::make_exception_ptr(std::runtime_error(res.error->message)));
+ } else if (res.notModified) {
return;
- }
-
- if (res.notModified) {
- // We got the same data back as last time. Abort early.
- return;
- }
-
- if (!loader->json || *loader->json != *res.data) {
+ } else if (res.noContent) {
+ loader->json = std::make_shared<const std::string>();
+ emitSpriteLoadedIfComplete();
+ } else {
// Only trigger a sprite loaded event we got new data.
loader->json = res.data;
emitSpriteLoadedIfComplete();
@@ -56,15 +53,12 @@ void SpriteStore::setURL(const std::string& url) {
loader->spriteRequest = fs->request(Resource::spriteImage(url, pixelRatio), [this](Response res) {
if (res.error) {
observer->onSpriteError(std::make_exception_ptr(std::runtime_error(res.error->message)));
+ } else if (res.notModified) {
return;
- }
-
- if (res.notModified) {
- // We got the same data back as last time. Abort early.
- return;
- }
-
- if (!loader->image || *loader->image != *res.data) {
+ } else if (res.noContent) {
+ loader->image = std::make_shared<const std::string>();
+ emitSpriteLoadedIfComplete();
+ } else {
loader->image = res.data;
emitSpriteLoadedIfComplete();
}