From 9b0b74dba6f33b49e2ed009fd0fef2755a944954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Fri, 23 Jun 2017 16:10:04 -0700 Subject: [ios] Fixed infinite loop zooming in past z23 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At zoom levels where the minimum 1 meter or 4 feet would be wider than the scale bar’s maximum width, the local variable holding the preferred row was left undefined. A loop that later iterated based on this row would effectively iterate infinitely until memory pressure forces the system to quit the application. --- platform/ios/src/MGLScaleBar.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/ios/src/MGLScaleBar.mm b/platform/ios/src/MGLScaleBar.mm index cd88c1e08e..410aa7d57e 100644 --- a/platform/ios/src/MGLScaleBar.mm +++ b/platform/ios/src/MGLScaleBar.mm @@ -188,9 +188,9 @@ static const CGFloat MGLFeetPerMeter = 3.28084; - (MGLRow)preferredRow { CLLocationDistance maximumDistance = [self maximumWidth] * [self unitsPerPoint]; - MGLRow row; BOOL useMetric = [self usesMetricSystem]; + MGLRow row = useMetric ? MGLMetricTable[0] : MGLImperialTable[0]; NSUInteger count = useMetric ? sizeof(MGLMetricTable) / sizeof(MGLMetricTable[0]) : sizeof(MGLImperialTable) / sizeof(MGLImperialTable[0]); -- cgit v1.2.1