summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-06-23 16:10:04 -0700
committerMinh Nguyễn <mxn@1ec5.org>2017-06-24 13:14:05 -0700
commit9b0b74dba6f33b49e2ed009fd0fef2755a944954 (patch)
tree79fb403046aeb008e693e52eafb2d71432b3b02e
parent3e40cab22dbf31f5575009a5e2841185c0868062 (diff)
downloadqtlocation-mapboxgl-9b0b74dba6f33b49e2ed009fd0fef2755a944954.tar.gz
[ios] Fixed infinite loop zooming in past z23
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.
-rw-r--r--platform/ios/src/MGLScaleBar.mm2
1 files changed, 1 insertions, 1 deletions
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]);