Skip to content

Commit d7feafa

Browse files
Bail out on invalid zoom level
1 parent df18fa9 commit d7feafa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/OpenStreetMap-esp32.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ std::optional<std::unique_ptr<MemoryBuffer>> OpenStreetMap::urlToBuffer(const St
377377

378378
bool OpenStreetMap::fetchTile(CachedTile &tile, uint32_t x, uint32_t y, uint8_t zoom, String &result)
379379
{
380+
if (zoom < 1 || zoom > OSM_MAX_ZOOM)
381+
result = "Invalid zoom level: " + String(zoom);
382+
380383
const uint32_t worldTileWidth = 1 << zoom;
381384
if (x >= worldTileWidth || y >= worldTileWidth)
382385
{

0 commit comments

Comments
 (0)