[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.
This commit is contained in:
Minh Nguyễn
2017-06-23 16:10:04 -07:00
committed by Minh Nguyễn
parent 3e40cab22d
commit 9b0b74dba6

View File

@@ -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]);