diff --git a/CHANGELOG.md b/CHANGELOG.md index d9ade70b..0f8f8c1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## Unreleased + + * Fixed crash when zoom is maxed far out. + ## 0.26.0 * `HttpTiles` will now attempt to use already downloaded tiles with a lower zoom level as diff --git a/walkers/src/tiles.rs b/walkers/src/tiles.rs index 9e1101c2..e69d21c9 100644 --- a/walkers/src/tiles.rs +++ b/walkers/src/tiles.rs @@ -158,7 +158,7 @@ impl HttpTiles { fn placeholder_with_different_zoom(&self, tile_id: TileId) -> Option { // Currently, only a single zoom level down is supported. - let zoom = tile_id.zoom - 1; + let zoom = tile_id.zoom.checked_sub(1)?; let x = (tile_id.x / 2, tile_id.x % 2); let y = (tile_id.y / 2, tile_id.y % 2);