Skip to content

Commit 6d8651e

Browse files
committed
iOS: Init CLLocationCoordinate2D variables with kCLLocationCoordinate2DInvalid
- Check if variable is valid by CLLocationCoordinate2DIsValid()
1 parent 00980e6 commit 6d8651e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/ios/GoogleMaps/PluginMapViewController.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ - (void)mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D
189189

190190
//
191191
maxZIndex = -1;
192-
CLLocationCoordinate2D touchPoint;
192+
CLLocationCoordinate2D touchPoint = kCLLocationCoordinate2DInvalid;
193+
193194
for (i = 0; i < [boundsHitList count]; i++) {
194195
key = [boundsHitList objectAtIndex:i];
195196
//plugin = [boundsPluginList objectAtIndex:i];
@@ -257,7 +258,7 @@ - (void)mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D
257258

258259
}
259260

260-
if (hitKey != nil) {
261+
if (hitKey != nil && CLLocationCoordinate2DIsValid(touchPoint)) {
261262
NSArray *tmp = [hitKey componentsSeparatedByString:@"_"];
262263
NSString *eventName = [NSString stringWithFormat:@"%@_click", [tmp objectAtIndex:0]];
263264
[self triggerOverlayEvent:eventName overlayId:hitKey coordinate:touchPoint];

src/ios/GoogleMaps/PluginUtil.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ + (CLLocationCoordinate2D)isPointOnTheGeodesicLine:(GMSPath *)path coordinate:(C
296296

297297
double minDistance = 999999999;
298298
double distance;
299-
CLLocationCoordinate2D mostClosePoint;
299+
CLLocationCoordinate2D mostClosePoint = kCLLocationCoordinate2DInvalid;
300300

301301
for (int i = 0; i < [inspectPoints count]; i++) {
302302
distance = GMSGeometryDistance([inspectPoints coordinateAtIndex:i], point);

0 commit comments

Comments
 (0)