From 00fff55cd35abb60ec72a844b252f25cc85ece3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 13 Sep 2023 22:33:14 +0200 Subject: [PATCH] Check for bounds overflow in the computed/approximated case --- src/map/map.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/map/map.cpp b/src/map/map.cpp index fcbfc37b..fde95e08 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -4,6 +4,7 @@ #define SAMPLES 100 +#define DELTA 1e-6 static void growLeft(const Coordinates &c, RectC &rect) { @@ -55,6 +56,11 @@ RectC Map::llBounds(const Projection &proj) growRight(xy2ll(QPointF(b.right(), y)), rect); } + if (rect.right() <= -180.0 + DELTA) + rect.setRight(180.0); + if (rect.left() >= 180.0 - DELTA) + rect.setLeft(-180.0); + return rect; }