diff --git a/include/util/viewport.hpp b/include/util/viewport.hpp index d16ba1462..fd0ac73f6 100644 --- a/include/util/viewport.hpp +++ b/include/util/viewport.hpp @@ -38,7 +38,10 @@ unsigned getFittedZoom(util::Coordinate south_west, util::Coordinate north_east) const double height_ratio = (max_y - min_y) / detail::VIEWPORT_HEIGHT; const auto zoom = detail::MAX_ZOOM - std::max(std::log(width_ratio), std::log(height_ratio)) * detail::INV_LOG_2; - return std::max(detail::MIN_ZOOM, zoom); + if (std::isfinite(zoom)) + return std::max(detail::MIN_ZOOM, zoom); + else + return detail::MIN_ZOOM; } }