summaryrefslogtreecommitdiff
path: root/src/mbgl/style/sources
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-21 16:28:11 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-21 19:33:36 +0200
commit1f8910de186f35216791a17a683a55f01031ec81 (patch)
treeee470e8e1ee6f85094afce6d1a227018b9780eb6 /src/mbgl/style/sources
parent86cddaf751e4c66f117b28fb013a43486581c948 (diff)
downloadqtlocation-mapboxgl-1f8910de186f35216791a17a683a55f01031ec81.tar.gz
Make Source::getZoomRange return an optional range
Diffstat (limited to 'src/mbgl/style/sources')
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.cpp8
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.hpp2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp
index 5ceb4f71e0..b050e5482e 100644
--- a/src/mbgl/style/sources/geojson_source_impl.cpp
+++ b/src/mbgl/style/sources/geojson_source_impl.cpp
@@ -153,9 +153,11 @@ void GeoJSONSource::Impl::loadDescription(FileSource& fileSource) {
});
}
-Range<uint8_t> GeoJSONSource::Impl::getZoomRange() const {
- assert(loaded);
- return { 0, options.maxzoom };
+optional<Range<uint8_t>> GeoJSONSource::Impl::getZoomRange() const {
+ if (loaded) {
+ return { { 0, options.maxzoom }};
+ }
+ return {};
}
std::unique_ptr<Tile> GeoJSONSource::Impl::createTile(const OverscaledTileID& tileID,
diff --git a/src/mbgl/style/sources/geojson_source_impl.hpp b/src/mbgl/style/sources/geojson_source_impl.hpp
index 05302d6bc0..b827a0b26c 100644
--- a/src/mbgl/style/sources/geojson_source_impl.hpp
+++ b/src/mbgl/style/sources/geojson_source_impl.hpp
@@ -28,7 +28,7 @@ public:
return util::tileSize;
}
- Range<uint8_t> getZoomRange() const final;
+ optional<Range<uint8_t>> getZoomRange() const final;
private:
void _setGeoJSON(const GeoJSON&);